Re: [fw-general] chaining the front controller

2007-10-16 Thread 7eicher

I like to reduce cost of reinstancating the front controller again and again,
but how can i handle a call like the following with the dispatch loop
proposal:

# content.phtml
div id=reportX
  ?php echo $this-widgetUri(reports/grid/users/page/3); ?
/div

in the action 'users' of controller 'grid' i would handle the parameter
'page' and the value 3 to return the the third page of the grid. the problem
with the dispatchloop in this example would be, how to pass the param to the
action without manipulating the orignal request object. another use case
would be to modifiy the request http header which can be existential in some
special cases.

in other words, if i would not use a front controller chain, i have to use a
request chain to have allways the right request object in place, for example
in the controller, view and where else. you have any ideas to implement a
request chain? maybe this could help improving performance dramaticaly.

markus


Matthew Weier O'Phinney-3 wrote:
 
 -- 7eicher [EMAIL PROTECTED] wrote
 (on Monday, 15 October 2007, 02:17 AM -0700):
 in my current project i built up a widget system based on ZF which
 allowes
 to run a front controller twice or more during runtime and getting the
 response of a so called subrequest in a view with:
 
 div id=calendar
   ?php echo $this-widget(calendar, utils, global-module); ?
 /div
 
 This post is for those who are interested in chaining the front
 controller
 object and getting allways the right instance when calling
 Zend_Controller_Front::getInstance().
 
 The Problem with current Zend_Controller_Front is, that it implements the
 singelton pattern and it allways give the current instance back. that
 means,
 its not possible to have more than one instance at the same time. of
 course,
 this behavior is neccessary for the helperbrooker, but this is another
 topic.
 
 Why do you need to run the front controller more than once during run
 time? It has a dispatch loop allowing you to loop over multiple actions
 during the same request -- so if you want to build up a widget system,
 simply create plugins that push and pop from an action stack (this is in
 fact part of the Zend_Layout proposal). 
 
 The reason for the front controller being a singleton is in part to
 simplify access to it from the various other areas (plugins, action
 controller, etc), but also because, with the loop, there should be no
 need for multiple instances. Can you better describe *why* you need
 multiple instances, as well as why looping does not solve this issue?
 
 
 -- 
 Matthew Weier O'Phinney
 PHP Developer| [EMAIL PROTECTED]
 Zend - The PHP Company   | http://www.zend.com/
 
 

-- 
View this message in context: 
http://www.nabble.com/chaining-the-front-controller-tf4625668s16154.html#a13230733
Sent from the Zend Framework mailing list archive at Nabble.com.



AW: [fw-general] file locking for Zend_Log

2007-10-16 Thread Leo Büttiker
I think they can. (May depend on the protocol you need for filesharing.) But
they shouldn't Loging can get a horible bottelneck very soon. Do loging on
every server an merge the files later on, or write to a database which does
better locking and can be replaced with a cluster.
leo 

-Ursprüngliche Nachricht-
Von: Holt, Joe [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 10. Oktober 2007 01:29
An: Zend Framework General
Betreff: [fw-general] file locking for Zend_Log



We have two servers that share a filesystem for log files. Can both servers
use the same file for logging purposes? Should they? I'm not able to find
any documentation regarding file locking and so forth.




Re: [fw-general] FlashMessenger and Controller plugins - Help wanted

2007-10-16 Thread Andries Seutens


lauren49 schreef:

Andries Seutens wrote:
  

Zend_Session_Namespace::setExpirationHops().




Oh, sweet! A much better solution than I don't think that's possible. :)
Thanks for posting it.

- Lauren
  


Apperently I was to quick. It still does not work.

Anybody has a clue how I can work around this issue?

Best,

--
Andries Seutens
http://andries.systray.be

Gecontroleerd op virussen door de JOJO Secure Gateway.


AW: [fw-general] chaining the front controller

2007-10-16 Thread Leo Büttiker
Markus please have a look at Zend Enhaced View. (i'd like to send you the
link, but the old story about the wiki gremlins...)

Looks like Zend Enhaced View solves allready most of your problems in a way
which is more destined by the framework.
Feel free to extend Zend Enhaced View with solutions that are not solved yet
by the existing code.
leo

-Ursprüngliche Nachricht-
Von: 7eicher [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 16. Oktober 2007 12:42
An: fw-general@lists.zend.com
Betreff: Re: [fw-general] chaining the front controller


I like to reduce cost of reinstancating the front controller again and
again, but how can i handle a call like the following with the dispatch loop
proposal:

# content.phtml
div id=reportX
  ?php echo $this-widgetUri(reports/grid/users/page/3); ? /div

in the action 'users' of controller 'grid' i would handle the parameter
'page' and the value 3 to return the the third page of the grid. the problem
with the dispatchloop in this example would be, how to pass the param to the
action without manipulating the orignal request object. another use case
would be to modifiy the request http header which can be existential in some
special cases.

in other words, if i would not use a front controller chain, i have to use a
request chain to have allways the right request object in place, for example
in the controller, view and where else. you have any ideas to implement a
request chain? maybe this could help improving performance dramaticaly.

markus


Matthew Weier O'Phinney-3 wrote:
 
 -- 7eicher [EMAIL PROTECTED] wrote
 (on Monday, 15 October 2007, 02:17 AM -0700):
 in my current project i built up a widget system based on ZF which 
 allowes to run a front controller twice or more during runtime and 
 getting the response of a so called subrequest in a view with:
 
 div id=calendar
   ?php echo $this-widget(calendar, utils, global-module); ? 
 /div
 
 This post is for those who are interested in chaining the front 
 controller object and getting allways the right instance when calling 
 Zend_Controller_Front::getInstance().
 
 The Problem with current Zend_Controller_Front is, that it implements 
 the singelton pattern and it allways give the current instance back. 
 that means, its not possible to have more than one instance at the 
 same time. of course, this behavior is neccessary for the 
 helperbrooker, but this is another topic.
 
 Why do you need to run the front controller more than once during run 
 time? It has a dispatch loop allowing you to loop over multiple 
 actions during the same request -- so if you want to build up a widget 
 system, simply create plugins that push and pop from an action stack 
 (this is in fact part of the Zend_Layout proposal).
 
 The reason for the front controller being a singleton is in part to 
 simplify access to it from the various other areas (plugins, action 
 controller, etc), but also because, with the loop, there should be no 
 need for multiple instances. Can you better describe *why* you need 
 multiple instances, as well as why looping does not solve this issue?
 
 
 --
 Matthew Weier O'Phinney
 PHP Developer| [EMAIL PROTECTED]
 Zend - The PHP Company   | http://www.zend.com/
 
 

--
View this message in context:
http://www.nabble.com/chaining-the-front-controller-tf4625668s16154.html#a13
230733
Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] chaining the front controller

2007-10-16 Thread Matthew Weier O'Phinney
-- 7eicher [EMAIL PROTECTED] wrote
(on Tuesday, 16 October 2007, 01:23 AM -0700):
 A) i dont know if the method of multiple dispatches can handle all the
 possible front controller plugins? 

Please look at the chapter on 'Zend_Controller Basics', which outlines
how the dispatch process works:

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

In there, you will see that once inside the dispatch loop, the
preDispatch() and postDispatch() plugins are called before and after
each action, respectively. The other plugins trigger at their
appropriate times before and after the dispatch loop.

So, while you wouldn't be triggering all plugins on each iteration of
the loop, those preceding the dispatch loop will have already been
triggered -- meaning if you create your ACL list early, you need only
check each action against it in preDispatch().

 and what would happen if someone uses a _forward in a controller? does
 this have any side effects?

I would suggest that any postDispatch() plugin you write for handling a
request stack would first check to see if there's already a forward
request. This is trivial to do:

if ($this-getRequest()-isDispatched()) {
// _forward() detected
return;
}
// now process our request stack...

 B) by the way, is it neccessary in the enhanced view proposal to inject data
 in the called view, or can i overwrite the view data of the native
 controller with my own data?

I'm not sure I understand the question. 


 what i like in the idea of having multiple instance is the context free ask
 for content. for example i have to check the acl's of my user and modules
 and i proof translate gettext files before dispatching in allready written
 front controller plugins. i also like the php virtual() function.
 unfortunately it dont work with sessions(i guess). 
 
 the idea is pretty good, but off course it has some footprints! once i was
 programming in lisp and it has a lot of charme, because it realises
 programming without side effects.
 
 cheers
 markus
 
 
 Matthew Weier O'Phinney-3 wrote:
  
  -- Parnell [EMAIL PROTECTED] wrote
  (on Monday, 15 October 2007, 07:38 AM -0600):
  I would imagine the footprint from running multiple front controllers
  would be pretty big!
  
  The idea is interesting though, I wonder if it would be more useful with
  a lighter front controller (such as Picora).
  
  As I've written in another response to this thread, I'm not convinced
  multiple instances are even required; with the dispatch loop available,
  a plugin that simply handles a request stack would likely achieve the
  same functionality.
  
  -- 
  Matthew Weier O'Phinney
  PHP Developer| [EMAIL PROTECTED]
  Zend - The PHP Company   | http://www.zend.com/
  
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/chaining-the-front-controller-tf4625668s16154.html#a13228825
 Sent from the Zend Framework mailing list archive at Nabble.com.
 

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


Re: [fw-general] chaining the front controller

2007-10-16 Thread Matthew Weier O'Phinney
-- 7eicher [EMAIL PROTECTED] wrote
(on Tuesday, 16 October 2007, 03:42 AM -0700):
 
 I like to reduce cost of reinstancating the front controller again and again,
 but how can i handle a call like the following with the dispatch loop
 proposal:
 
 # content.phtml
 div id=reportX
   ?php echo $this-widgetUri(reports/grid/users/page/3); ?
 /div
 
 in the action 'users' of controller 'grid' i would handle the parameter
 'page' and the value 3 to return the the third page of the grid. the problem
 with the dispatchloop in this example would be, how to pass the param to the
 action without manipulating the orignal request object. another use case
 would be to modifiy the request http header which can be existential in some
 special cases.

You should take a look at Zend_View_Helper_Action in the incubator, as
it solves this problem already.


 in other words, if i would not use a front controller chain, i have to use a
 request chain to have allways the right request object in place, for example
 in the controller, view and where else. you have any ideas to implement a
 request chain? maybe this could help improving performance dramaticaly.
 
 markus
 
 
 Matthew Weier O'Phinney-3 wrote:
  
  -- 7eicher [EMAIL PROTECTED] wrote
  (on Monday, 15 October 2007, 02:17 AM -0700):
  in my current project i built up a widget system based on ZF which
  allowes
  to run a front controller twice or more during runtime and getting the
  response of a so called subrequest in a view with:
  
  div id=calendar
?php echo $this-widget(calendar, utils, global-module); ?
  /div
  
  This post is for those who are interested in chaining the front
  controller
  object and getting allways the right instance when calling
  Zend_Controller_Front::getInstance().
  
  The Problem with current Zend_Controller_Front is, that it implements the
  singelton pattern and it allways give the current instance back. that
  means,
  its not possible to have more than one instance at the same time. of
  course,
  this behavior is neccessary for the helperbrooker, but this is another
  topic.
  
  Why do you need to run the front controller more than once during run
  time? It has a dispatch loop allowing you to loop over multiple actions
  during the same request -- so if you want to build up a widget system,
  simply create plugins that push and pop from an action stack (this is in
  fact part of the Zend_Layout proposal). 
  
  The reason for the front controller being a singleton is in part to
  simplify access to it from the various other areas (plugins, action
  controller, etc), but also because, with the loop, there should be no
  need for multiple instances. Can you better describe *why* you need
  multiple instances, as well as why looping does not solve this issue?
  
  
  -- 
  Matthew Weier O'Phinney
  PHP Developer| [EMAIL PROTECTED]
  Zend - The PHP Company   | http://www.zend.com/
  
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/chaining-the-front-controller-tf4625668s16154.html#a13230733
 Sent from the Zend Framework mailing list archive at Nabble.com.
 

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


[fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Kexiao Liao

In the config.ini file, we need to declare a string variable, it contains
about 200 characters and needs to be in a good format. Is there anyway we
can input new line/return character inside these 200 characters to make it
look good instead of putting all of them in one line.
-- 
View this message in context: 
http://www.nabble.com/Zend_Config_Ini-file-config.ini-tf4634146s16154.html#a13233386
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Simon Mundy
Can you not try it in an XML config file instead? I don't think .ini  
files are set up to take multi-line values.




In the config.ini file, we need to declare a string variable, it  
contains
about 200 characters and needs to be in a good format. Is there  
anyway we
can input new line/return character inside these 200 characters to  
make it

look good instead of putting all of them in one line.
--
View this message in context: 
http://www.nabble.com/Zend_Config_Ini-file-config.ini-tf4634146s16154.html#a13233386
Sent from the Zend Framework mailing list archive at Nabble.com.


--

Simon Mundy | Director | PEPTOLAB

   
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
4124

http://www.peptolab.com



Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Kexiao Liao

Anyone know how to use multi-line value in the config.ini file? Thanks in
advance.



Simon Mundy wrote:
 
 Can you not try it in an XML config file instead? I don't think .ini  
 files are set up to take multi-line values.
 

 In the config.ini file, we need to declare a string variable, it  
 contains
 about 200 characters and needs to be in a good format. Is there  
 anyway we
 can input new line/return character inside these 200 characters to  
 make it
 look good instead of putting all of them in one line.
 -- 
 View this message in context:
 http://www.nabble.com/Zend_Config_Ini-file-config.ini-tf4634146s16154.html#a13233386
 Sent from the Zend Framework mailing list archive at Nabble.com.
 
 --
 
 Simon Mundy | Director | PEPTOLAB
 

 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
 4124
 http://www.peptolab.com
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Config_Ini-file-config.ini-tf4634146s16154.html#a13233812
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Christer Edvartsen

key = stuff on line 1
   stuff on line 2
   stuff on line 3

Is that what you mean?

Kexiao Liao wrote:

Anyone know how to use multi-line value in the config.ini file? Thanks in
advance.



Simon Mundy wrote:
Can you not try it in an XML config file instead? I don't think .ini  
files are set up to take multi-line values.


In the config.ini file, we need to declare a string variable, it  
contains
about 200 characters and needs to be in a good format. Is there  
anyway we
can input new line/return character inside these 200 characters to  
make it

look good instead of putting all of them in one line.
--
View this message in context:
http://www.nabble.com/Zend_Config_Ini-file-config.ini-tf4634146s16154.html#a13233386
Sent from the Zend Framework mailing list archive at Nabble.com.

--

Simon Mundy | Director | PEPTOLAB

   
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
4124

http://www.peptolab.com







--
mvh
Christer Edvartsen

I will not snap bras


Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Simon Mundy

What happens if you define your value like so:-

[section]
value = My
multi
line
value

Anyone know how to use multi-line value in the config.ini file?  
Thanks in

advance.







--

Simon Mundy | Director | PEPTOLAB

   
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
4124

http://www.peptolab.com



Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Jack Sleight
As Simon said, I don't think INI files support splitting parameter 
values across multiple lines. I've never seen it done, and a quick 
Google came back with nothing. I'm afraid it's (probably) impossible. 
Again, as Simon said, why not use an XML configuration file? Then you 
can use line breaks.


Kexiao Liao wrote:

Anyone know how to use multi-line value in the config.ini file? Thanks in
advance.



Simon Mundy wrote:
  

  


--
Jack


Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Matthew Weier O'Phinney
-- Kexiao Liao [EMAIL PROTECTED] wrote
(on Tuesday, 16 October 2007, 06:38 AM -0700):
 Anyone know how to use multi-line value in the config.ini file? Thanks in
 advance.

Use double quotes. (This has been supported since 5.0.0)

 Simon Mundy wrote:
  
  Can you not try it in an XML config file instead? I don't think .ini  
  files are set up to take multi-line values.
  
  
   In the config.ini file, we need to declare a string variable, it
   contains about 200 characters and needs to be in a good format. Is
   there  anyway we can input new line/return character inside these
   200 characters to  make it look good instead of putting all of
   them in one line.

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


Re: [fw-general] FlashMessenger and Controller plugins - Help wanted

2007-10-16 Thread Shekar C Reddy
Andries,

I guess you need an exit() from the application for the FlashMessenger to
work as you expect. The reason it is working on second page load may be due
to the fact it is exiting the app somewhere due to some condition.

Are you sure you are exit()ing the app on errors/result?

HTH




On 10/16/07, Andries Seutens [EMAIL PROTECTED] wrote:


 lauren49 schreef:
  Andries Seutens wrote:
 
  Zend_Session_Namespace::setExpirationHops().
 
 
 
  Oh, sweet! A much better solution than I don't think that's possible.
 :)
  Thanks for posting it.
 
  - Lauren
 

 Apperently I was to quick. It still does not work.

 Anybody has a clue how I can work around this issue?

 Best,

 --
 Andries Seutens
 http://andries.systray.be


 Gecontroleerd op virussen door de JOJO Secure Gateway.




Re: [fw-general] FlashMessenger and Controller plugins - Help wanted

2007-10-16 Thread Shekar C Reddy
I meant page redirect() instead of page forward(). Session write-closes and
re-reads on redirect/exit.




On 10/16/07, Shekar C Reddy [EMAIL PROTECTED] wrote:

 Andries,

 I guess you need an exit() from the application for the FlashMessenger to
 work as you expect. The reason it is working on second page load may be due
 to the fact it is exiting the app somewhere due to some condition.

 Are you sure you are exit()ing the app on errors/result?

 HTH




  On 10/16/07, Andries Seutens [EMAIL PROTECTED] wrote:

 
  lauren49 schreef:
   Andries Seutens wrote:
  
   Zend_Session_Namespace::setExpirationHops().
  
  
  
   Oh, sweet! A much better solution than I don't think that's
  possible. :)
   Thanks for posting it.
  
   - Lauren
  
 
  Apperently I was to quick. It still does not work.
 
  Anybody has a clue how I can work around this issue?
 
  Best,
 
  --
  Andries Seutens
  http://andries.systray.be
 
 
  Gecontroleerd op virussen door de JOJO Secure Gateway.
 
 



[fw-general] DB Table - Update with Limit

2007-10-16 Thread Ian Warner

Hi

It doesnt seem as though DB table allows for an update with a limit clause

Is this right?

Is it better to write a qhole query or are there alternatives using the 
data models.


Ian


[fw-general] Zend_Uri improvements proposal ready for review

2007-10-16 Thread Shahar Evron
Hi all,

For quite some time now I feel that Zend_Uri is a very stupid
component, in the sense that it adds very little except for some
syntactic sugar over what functions like parse_url() can do.

Most notably, I would like to be able to:
- Represent abstract or incomplete URIs (such as one might find in an 
  HTML page - a href=../foo/bar.
- Allow merging relative and absolute URIs and setting base URL when 
  creating URI objects from strings.
- Allow for better subclassing abilities (providing the option to 
  create scheme-specific classes by the user, for example for FTP URIs).

I expect the changes to introduce some small API changes, breaking
backwards compatibility of some of the method calls (but not the
important ones IMHO). 

There is an option to provide most of the functionality without breaking
the API, but I think that the old API is not entirely coherent and
*should* be broken.

My proposal for those changes is here:
http://framework.zend.com/wiki/display/ZFPROP/Zend_Uri+Improvements
+-+Shahar+Evron

Please review it and send me your comments. 


Thanks!

Shahar.


signature.asc
Description: This is a digitally signed message part


[fw-general] Beginner Zend_Db question about qouteInto and quoting in general with mysql

2007-10-16 Thread Truppe Steven
Hi folks,

i have a stupid problem here, when i try to quote an sql statement like:

SELECT COUNT(*) FROM $tablename

with the code

$db-query('SELECT COUNT(*) FROM ?', array($tablename));

i get the following log output

*[Exception]*: Zend_Db_Statement_Exception
*[Message]*: SQLSTATE[42000]: Syntax error or access violation: 1064
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '?' at line 1
*[File]*:

/var/www/mystuff/apps/library/ZendFramework-1.0.1/library/Zend/Db/Statement/Pdo.php
*[Line]*: 68

To be sure it's now how i use the quoting i've tried an SQL statement
with phpMyAdmin

SELECT COUNT(*) FROM `tableName`;

which is working, so the quotes can be used there.

I hope someone here can help me, i've talked on #zftalk but found no
solution.
I've tried allmost all methods to quote parameters (the ? thing, named
parameters with different methods or classes like zend_db_statement).


best regards,
Steven Truppe






RE: [fw-general] DB Table - Update with Limit

2007-10-16 Thread Bill Karwin
Right: Zend_Db_Table generally restricts to portable SQL, but
UPDATE...LIMIT is a MySQL extension to SQL.  This usage is not standard
SQL and it is not supported by other brands of RDBMS.

You can write your own methods in your concrete Table classes, or you
can use Adapter methods like query() to run SQL statements you specify.

Regards,
Bill Karwin

 -Original Message-
 From: Ian Warner [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 16, 2007 9:23 AM
 To: Zend Framework
 Subject: [fw-general] DB Table - Update with Limit
 
 Hi
 
 It doesnt seem as though DB table allows for an update with a 
 limit clause
 
 Is this right?
 
 Is it better to write a qhole query or are there alternatives 
 using the data models.
 
 Ian
 


Re: [fw-general] Zend_Uri improvements proposal ready for review

2007-10-16 Thread Michael B Allen
On 10/16/07, Shahar Evron [EMAIL PROTECTED] wrote:
 - Represent abstract or incomplete URIs (such as one might find in an
   HTML page - a href=../foo/bar.

Hi Shahar,

I think building URIs from only a relative path is a mistake -
conceptually and programmatically. A URI is not valid unless it has at
least a scheme.

However, it does make sense to allow constructing a URI from a URI
object and a relative path. Meaning you retrieve a context URI
representing the HTML page and then construct a new URI object with it
and the relative path '../foo/bar' [1].

That's how Java's URL class does it BTW.

Mike

[1] Beware that path canonicalization is notoriously tricky and has in
many instances lead to security vulnerabilities in high profile
products. For a good path canonicalization routine a state machine
usually turns out to be most correct (and if it's not it's easy to fix
without screwing something else up). The following is C but of course
it's not terribly difficult to translate this to PHP (e.g. *dst++ =
*src++ becomes dst[di++] = src[si++]).

#define ST_START 1
#define ST_SEPARATOR 2
#define ST_NORMAL3
#define ST_DOT1  4
#define ST_DOT2  5

int
path_canon(const str_t *src, const str_t *slim,
str_t *dst, str_t *dlim,
int srcsep, int dstsep)
{
str_t *start = dst, *prev;
int state = ST_START;

while (src  slim  dst  dlim) {
switch (state) {
case ST_START:
state = ST_SEPARATOR;
if (*src == srcsep) {
*dst++ = dstsep; src++;
break;
}
case ST_SEPARATOR:
if (*src == '\0') {
*dst = '\0';
return dst - start;
} else if (*src == srcsep) {
src++;
break;
} else if (*src == '.') {
state = ST_DOT1;
} else {
state = ST_NORMAL;
}
*dst++ = *src++;
break;
case ST_NORMAL:
if (*src == '\0') {
*dst = '\0';
return dst - start;
} else if (*src == srcsep) {
state = ST_SEPARATOR;
*dst++ = dstsep; src++;
break;
}
*dst++ = *src++;
break;
case ST_DOT1:
if (*src == '\0') {
dst--;
*dst = '\0';
return dst - start;
} else if (*src == srcsep) {
state = ST_SEPARATOR;
dst--;
break;
} else if (*src == '.') {
state = ST_DOT2;
*dst++ = *src++;
break;
}
state = ST_NORMAL;
*dst++ = *src++;
break;
case ST_DOT2:
if (*src == '\0' || *src == srcsep) {
/* note src is not advanced in this case */
state = ST_SEPARATOR;
dst -= 2;
prev = dst - 1;
if (dst == start || prev == start) {
break;
}
do {
dst--;
prev = dst - 1;
} while (dst  start  *prev != dstsep);
break;
}
state = ST_NORMAL;
*dst++ = *src++;
break;
}
}

PMNO(errno = ERANGE);
return -1;
}

-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/


RE: [fw-general] Beginner Zend_Db question about qouteInto and quoting in general with mysql

2007-10-16 Thread Bill Karwin
Parameter placeholders are for values, not identifiers.  It is invalid
SQL syntax to use placeholders for table names or column names.  This is
generally true of SQL implementations.  It is not specific to Zend
Framework usage.

The reason is that the RDBMS needs to know at prepare-time which tables
and columns are used in the statement, so it can decide on an
optimization strategy (such as which indexes to use, etc.).  Therefore
you must specify the table.  You can't defer it and specify it later at
execute-time, which is what parameters are for.

To use a PHP variable for the table name in your SQL statement and
delimit the identifiers, I recommend doing it using simple string
interpolation, not as a parameter:

  $tablenameDelimited = $db-quoteIdentifier($tablename);
  $stmt = $db-query(SELECT COUNT(*) FROM $tablenameDelimited);

By interpolating the table name into the SQL string, it is available to
the SQL engine at prepare-time.

Regards,
Bill Karwin

 -Original Message-
 From: Truppe Steven [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 16, 2007 10:40 AM
 To: fw-general@lists.zend.com
 Subject: [fw-general] Beginner Zend_Db question about 
 qouteInto and quoting in general with mysql
 
 Hi folks,
 
 i have a stupid problem here, when i try to quote an sql 
 statement like:
 
 SELECT COUNT(*) FROM $tablename
 
 with the code
 
 $db-query('SELECT COUNT(*) FROM ?', array($tablename));
 
 i get the following log output
 
 *[Exception]*: Zend_Db_Statement_Exception
 *[Message]*: SQLSTATE[42000]: Syntax error or access 
 violation: 1064
 You have an error in your SQL syntax; check the manual that
 corresponds to your MySQL server version for the right 
 syntax to use
 near '?' at line 1
 *[File]*:
 
 /var/www/mystuff/apps/library/ZendFramework-1.0.1/library/Zend
 /Db/Statement/Pdo.php
 *[Line]*: 68
 
 To be sure it's now how i use the quoting i've tried an SQL 
 statement with phpMyAdmin
 
 SELECT COUNT(*) FROM `tableName`;
 
 which is working, so the quotes can be used there.
 
 I hope someone here can help me, i've talked on #zftalk but 
 found no solution.
 I've tried allmost all methods to quote parameters (the ? 
 thing, named parameters with different methods or classes 
 like zend_db_statement).
 
 
 best regards,
 Steven Truppe
 
 
 
 
 


Re: [fw-general] Beginner Zend_Db question about qouteInto and quoting in general with mysql

2007-10-16 Thread Truppe Steven
Thank you very much for your reply, i was a bit lost. It's working now!

best regards,
Steven Truppe

Bill Karwin wrote:
 Parameter placeholders are for values, not identifiers.  It is invalid
 SQL syntax to use placeholders for table names or column names.  This is
 generally true of SQL implementations.  It is not specific to Zend
 Framework usage.

 The reason is that the RDBMS needs to know at prepare-time which tables
 and columns are used in the statement, so it can decide on an
 optimization strategy (such as which indexes to use, etc.).  Therefore
 you must specify the table.  You can't defer it and specify it later at
 execute-time, which is what parameters are for.

 To use a PHP variable for the table name in your SQL statement and
 delimit the identifiers, I recommend doing it using simple string
 interpolation, not as a parameter:

   $tablenameDelimited = $db-quoteIdentifier($tablename);
   $stmt = $db-query(SELECT COUNT(*) FROM $tablenameDelimited);

 By interpolating the table name into the SQL string, it is available to
 the SQL engine at prepare-time.

 Regards,
 Bill Karwin

   
 -Original Message-
 From: Truppe Steven [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 16, 2007 10:40 AM
 To: fw-general@lists.zend.com
 Subject: [fw-general] Beginner Zend_Db question about 
 qouteInto and quoting in general with mysql

 Hi folks,

 i have a stupid problem here, when i try to quote an sql 
 statement like:

 SELECT COUNT(*) FROM $tablename

 with the code

 $db-query('SELECT COUNT(*) FROM ?', array($tablename));

 i get the following log output

 *[Exception]*: Zend_Db_Statement_Exception
 *[Message]*: SQLSTATE[42000]: Syntax error or access 
 violation: 1064
 You have an error in your SQL syntax; check the manual that
 corresponds to your MySQL server version for the right 
 syntax to use
 near '?' at line 1
 *[File]*:
 
 /var/www/mystuff/apps/library/ZendFramework-1.0.1/library/Zend
 /Db/Statement/Pdo.php
 *[Line]*: 68

 To be sure it's now how i use the quoting i've tried an SQL 
 statement with phpMyAdmin

 SELECT COUNT(*) FROM `tableName`;

 which is working, so the quotes can be used there.

 I hope someone here can help me, i've talked on #zftalk but 
 found no solution.
 I've tried allmost all methods to quote parameters (the ? 
 thing, named parameters with different methods or classes 
 like zend_db_statement).


 best regards,
 Steven Truppe





 

   


Re: [fw-general] FlashMessenger and Controller plugins - Help wanted

2007-10-16 Thread Andries Seutens

Hi,

I am not using redirect(), nor forward(). I would like to stay in the 
current request.


Best,

Andries Seutens

Shekar C Reddy schreef:
I meant page redirect() instead of page forward(). Session write-closes 
and re-reads on redirect/exit.
 



 
On 10/16/07, *Shekar C Reddy* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Andries,
 
I guess you need an exit() from the application for the

FlashMessenger to work as you expect. The reason it is working on
second page load may be due to the fact it is exiting the app
somewhere due to some condition.
 
Are you sure you are exit()ing the app on errors/result?
 
HTH
 



 
On 10/16/07, *Andries Seutens*  [EMAIL PROTECTED]

mailto:[EMAIL PROTECTED] wrote:


lauren49 schreef:
  Andries Seutens wrote:

  Zend_Session_Namespace::setExpirationHops().
 
 

  Oh, sweet! A much better solution than I don't think that's
possible. :)
  Thanks for posting it.

  - Lauren


Apperently I was to quick. It still does not work.

Anybody has a clue how I can work around this issue?

Best,

--
Andries Seutens
http://andries.systray.be http://andries.systray.be/


Gecontroleerd op virussen door de JOJO Secure Gateway.






No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.488 / Virus Database: 269.14.12/1073 - Release Date: 16/10/2007 8:22




[fw-general] Troubles trying to understand how to extend Zend_Log

2007-10-16 Thread Truppe Steven
Hi again,

i have found debug_backtrace() function in php that returns all
information about the current method/function called. So i want to be
able to pass the result of debug_backtrace function to my Zend_Log
somehow so it gets output in a certain format. So i can just use

$log-debug_backtrace();

in every method/function that should get debugged.

Now the question is how to best achive this ? Should i just extend
Zend/Log/Writer/Abstract.php and add the debug_backtrace() method ? Or
is there another way with events or custom formatter ?

I'm very curious about the answer.


best regards,
Steven Truppe


RE: [fw-general] Troubles trying to understand how to extend Zend_Log

2007-10-16 Thread Bill Karwin
Here's one solution:

?php
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
class Karwin_Log extends Zend_Log
{
  const DEBUG_BACKTRACE = 8;
  public function debug_backtrace($message = null)
  {
$backtrace = array_shift(debug_backtrace());
unset($backtrace['object']);
$backtrace = print_r($backtrace, true);
$message = (array) $message;
array_push($message, $backtrace);
$message = array(implode(': ', $message));
$this-__call('DEBUG_BACKTRACE', $message);
  }
}

$log = new Karwin_Log(new Zend_Log_Writer_Stream('php://output'));
$log-debug_backtrace('Something happened');

Regards,
Bill Karwin

 -Original Message-
 From: Truppe Steven [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 16, 2007 1:24 PM
 To: fw-general@lists.zend.com
 Subject: [fw-general] Troubles trying to understand how to 
 extend Zend_Log
 
 Hi again,
 
 i have found debug_backtrace() function in php that returns 
 all information about the current method/function called. So 
 i want to be able to pass the result of debug_backtrace 
 function to my Zend_Log somehow so it gets output in a 
 certain format. So i can just use
 
 $log-debug_backtrace();
 
 in every method/function that should get debugged.
 
 Now the question is how to best achive this ? Should i just 
 extend Zend/Log/Writer/Abstract.php and add the 
 debug_backtrace() method ? Or is there another way with 
 events or custom formatter ?
 
 I'm very curious about the answer.
 
 
 best regards,
 Steven Truppe
 


Re: [fw-general] Troubles trying to understand how to extend Zend_Log

2007-10-16 Thread Truppe Steven
I have to thank you again =), the actual code looks like

class Byteshelter_Log extends Zend_Log
{
public function __construct($writer = null)
{
parent::__construct($writer);
}

/**
 * Outputs information about the current method/function (file,
line, name, args)
 */
public function traceFunc($showArgs = false)
{
$tmp = debug_backtrace();
$trace = $tmp[1];
$msg =  [traceFunc::. $trace['function'] .()]\n .
[in file] . $trace['file'] .\n.
[on line] . $trace['line'];

// Render argument list ?
if ($showArgs) {
$msg .= [argument list]\n;
$msg .= print_r($trace['args'], true);
}

$this-debug($msg);
}
}


So inside every method/function i just need

$log-traceFunc();

that generates a [DEBUG] message with parameters and file/line/name of
the actual function/method,
that's realy handsome.

best regards,
Steven Truppe


Bill Karwin wrote:
 Here's one solution:

 ?php
 require_once 'Zend/Loader.php';
 Zend_Loader::registerAutoload();
 class Karwin_Log extends Zend_Log
 {
   const DEBUG_BACKTRACE = 8;
   public function debug_backtrace($message = null)
   {
 $backtrace = array_shift(debug_backtrace());
 unset($backtrace['object']);
 $backtrace = print_r($backtrace, true);
 $message = (array) $message;
 array_push($message, $backtrace);
 $message = array(implode(': ', $message));
 $this-__call('DEBUG_BACKTRACE', $message);
   }
 }

 $log = new Karwin_Log(new Zend_Log_Writer_Stream('php://output'));
 $log-debug_backtrace('Something happened');

 Regards,
 Bill Karwin

   
 -Original Message-
 From: Truppe Steven [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 16, 2007 1:24 PM
 To: fw-general@lists.zend.com
 Subject: [fw-general] Troubles trying to understand how to 
 extend Zend_Log

 Hi again,

 i have found debug_backtrace() function in php that returns 
 all information about the current method/function called. So 
 i want to be able to pass the result of debug_backtrace 
 function to my Zend_Log somehow so it gets output in a 
 certain format. So i can just use

 $log-debug_backtrace();

 in every method/function that should get debugged.

 Now the question is how to best achive this ? Should i just 
 extend Zend/Log/Writer/Abstract.php and add the 
 debug_backtrace() method ? Or is there another way with 
 events or custom formatter ?

 I'm very curious about the answer.


 best regards,
 Steven Truppe

 

   


Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread etng
5.0.0?
ini has version?

On 10/16/07, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:

 -- Kexiao Liao [EMAIL PROTECTED] wrote
 (on Tuesday, 16 October 2007, 06:38 AM -0700):
  Anyone know how to use multi-line value in the config.ini file? Thanks
 in
  advance.

 Use double quotes. (This has been supported since 5.0.0)

  Simon Mundy wrote:
  
   Can you not try it in an XML config file instead? I don't think .ini
   files are set up to take multi-line values.
  
   
In the config.ini file, we need to declare a string variable, it
contains about 200 characters and needs to be in a good format. Is
there  anyway we can input new line/return character inside these
200 characters to  make it look good instead of putting all of
them in one line.

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




-- 
http://www.etng.net/blog


Re: [fw-general] Zend_Config_Ini file config.ini

2007-10-16 Thread Matthew Weier O'Phinney
-- etng [EMAIL PROTECTED] wrote
(on Wednesday, 17 October 2007, 09:52 AM +0800):
 5.0.0?
 ini has version?

PHP has supported INI files with multiline strings since 5.0.0.

 
 On 10/16/07, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:
 
 -- Kexiao Liao [EMAIL PROTECTED] wrote
 (on Tuesday, 16 October 2007, 06:38 AM -0700):
  Anyone know how to use multi-line value in the config.ini file? Thanks 
 in
  advance.
 
 Use double quotes. (This has been supported since 5.0.0)
 
  Simon Mundy wrote:
  
   Can you not try it in an XML config file instead? I don't think .ini
   files are set up to take multi-line values.
  
   
In the config.ini file, we need to declare a string variable, it
contains about 200 characters and needs to be in a good format. Is
there  anyway we can input new line/return character inside these
200 characters to  make it look good instead of putting all of
them in one line.
 
 --
 Matthew Weier O'Phinney
 PHP Developer| [EMAIL PROTECTED]
 Zend - The PHP Company   | http://www.zend.com/
 
 
 
 
 --
 http://www.etng.net/blog

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


Re: [fw-general] FlashMessenger and Controller plugins - Help wanted

2007-10-16 Thread Shekar C Reddy
Maybe, you could try write-closing and re-reading the session in the same
request?





On 10/16/07, Andries Seutens [EMAIL PROTECTED] wrote:

 Hi,

 I am not using redirect(), nor forward(). I would like to stay in the
 current request.

 Best,

 Andries Seutens

 Shekar C Reddy schreef:
  I meant page redirect() instead of page forward(). Session write-closes
  and re-reads on redirect/exit.
 
 
 
 
  On 10/16/07, *Shekar C Reddy* [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
  Andries,
 
  I guess you need an exit() from the application for the
  FlashMessenger to work as you expect. The reason it is working on
  second page load may be due to the fact it is exiting the app
  somewhere due to some condition.
 
  Are you sure you are exit()ing the app on errors/result?
 
  HTH
 
 
 
 
  On 10/16/07, *Andries Seutens*  [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] wrote:
 
 
  lauren49 schreef:
Andries Seutens wrote:
  
Zend_Session_Namespace::setExpirationHops().
   
   
  
Oh, sweet! A much better solution than I don't think that's
  possible. :)
Thanks for posting it.
  
- Lauren
  
 
  Apperently I was to quick. It still does not work.
 
  Anybody has a clue how I can work around this issue?
 
  Best,
 
  --
  Andries Seutens
  http://andries.systray.be http://andries.systray.be/
 
 
  Gecontroleerd op virussen door de JOJO Secure Gateway.
 
 
 
 
  
 
  No virus found in this incoming message.
  Checked by AVG Free Edition.
  Version: 7.5.488 / Virus Database: 269.14.12/1073 - Release Date:
 16/10/2007 8:22