RE: [fw-general] Http upload proposal

2007-02-13 Thread Andi Gutmans
It could be interesting but it would have to be completely new code and
not adapted code from PEAR.
We don't accept any contributions which aren't 100% written from
scratch.
We won't be accepting new components for 1.0 but we definitely plan on
allowing development to continue in incubator which can then get into
follow-up releases.

Andi 

> -Original Message-
> From: Sylvain Philip [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 13, 2007 4:15 PM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Http upload proposal
> 
> Hello,
> 
> I would like to know if there is already some ideas to access 
> $_FILES array in zend framework like with pear: 
> http://pear.php.net/package/HTTP_Upload ?
> 
> I have coded some librairies classes (an adaptation of Pear 
> http_upload) to manage easily and securely  files which are 
> submited from html form:
> 
> An exemple to use it:
> 
> try{
> 
> $upload = new Zend_Http_Upload();
> $file = $upload->getFile('myfile') ;
> $file->setValidExtensions(array('jpg','jpeg','gif','png'),'acc
> ept'); //or deny $file->nameToSafe(); 
> $file->moveTo(/'home/www/images/');
> 
> } catch (Zend_Http_Upload_Exception $e) {}
> 
> I'm sure a lot of Zend framework users would appreciate this 
> (essential) functionnality...
> 
> 
> 


RE: [fw-general] Code optimizations

2007-02-13 Thread Andi Gutmans
Hi Stephane,

Our focus right now is getting 0.9 out in March (one month after 0.8 ships this 
coming week). For 0.9 we plan to be feature complete for 1.0 and move to bug 
fixing mode only (and minor tweaks if needed). At that time we could also apply 
fixes for serious performance bottlenecks as long as they don't lead to drastic 
changes in the code base.

While performance is not a focus of ours per-se at this point (though the 
developers do try and code well) I think it'd still be interesting for you to 
share any significant findings even if they are not addressed right away. Best 
to focus though on real-world app bottlenecks and not synthetic benchmarks with 
for(;;) loops.

Thanks,
Andi


> -Original Message-
> From: Stéphane Bisinger [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 13, 2007 12:48 PM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Code optimizations
> 
> Hi all,
> I was wondering if the current code in the Core section of 
> the framework has been optimized in any way. I know that this 
> is yet a preview, but it is not so far from version 1.0.0, so 
> it could be the right time to think about this kind of 
> issues. I'm telling you this because using ZF in a large 
> application I could find some bottlenecks in the framework itself:
> for instance, if you load a medium sized ini file with 
> Zend_Config_Ini, the recursive function calls in the 
> constructor slows down the application quite a bit. In 
> particular, if there are a lot of extended sections the 
> recursion happens for two functions 
> (Zend_Config_Ini::_processExtends and 
> Zend_Config_Ini::_processKey ) slowing everything down.
> 
> There are other similar issues around the code which come up 
> with a simple profiling and I think that indeed some 
> improvements should be made. What do you think about it? Is 
> the code mature enough to start toying with optimizations?
> If you feel the time is right, I might have a look myself.
> 
> Best regards,
> 
> Stéphane
> 
> 
>   
> ___
> The all-new Yahoo! Mail goes wherever you go - free your 
> email address from your Internet provider. 
> http://uk.docs.yahoo.com/nowyoucan.html
> 


[fw-general] Http upload proposal

2007-02-13 Thread Sylvain Philip

Hello,

I would like to know if there is already some ideas to access $_FILES array in zend framework like 
with pear: http://pear.php.net/package/HTTP_Upload ?


I have coded some librairies classes (an adaptation of Pear http_upload) to manage easily and 
securely  files which are submited from html form:


An exemple to use it:

try{

$upload = new Zend_Http_Upload();
$file = $upload->getFile('myfile') ;
$file->setValidExtensions(array('jpg','jpeg','gif','png'),'accept'); //or deny
$file->nameToSafe();
$file->moveTo(/'home/www/images/');

} catch (Zend_Http_Upload_Exception $e) {}

I'm sure a lot of Zend framework users would appreciate this (essential) 
functionnality...




Re: [fw-general] Zend_Filesystem proposal

2007-02-13 Thread Kevin McArthur
If this goes forward there are some excellent facilities within Zend_Pdf for 
binary file reading/parsing that willie wrote that should probably get 
integrated.

Kevin McArthur
  - Original Message - 
  From: Colin Ross 
  To: fw-general@lists.zend.com 
  Sent: Tuesday, February 13, 2007 4:44 PM
  Subject: Re: [fw-general] Zend_Filesystem proposal


  As far as I have known, there isn't a practical way for php to create/modify 
files that are NOT owned by the apache user...

  I think this kind of a class would be a great thing for managing assets in an 
application, like documents. 

  I have implemented something like this before, but it was very specialized 
(for audio files) with no real ACL or metadata stuff.   I actually just 
replaced it with some code ontop of the SPL DirectoryIterator/ etc. 

  c


  On 2/13/07, Xavier Vidal Piera <[EMAIL PROTECTED]> wrote:
Hi

I'm wondering if it can be a good idea to write a Zend class to manage 
files inside a special path for our applications.

In short, many times we need to manage files, and we don't want to store 
them in the database. Actually, the OS filesystem is the best place to store 
files IMHO, so writing a wrapper to let the developers manage files within the 
applications could be a useful tool. 

The main class could be extended to support different operative systems, so 
search facilities and other features can be optimized for each OS.

The main goals of this wrapper:
- search files
- list files from a folder 
- read and write files
- search through file contents? (using OS specific functions)
- store metadata somewhere about access permissions to files and folders 
(database?, file per folder? store a Zend_Acl?..)

Of course, all the files will belong to the apache user, i don't know which 
can be the consequences of this design, but a wrapper could be useful imho.



-- 
Xavier Vidal Piera 
Enginyer Tècnic Informàtic de Gestió 
Tècnic Especialista Informàtic d'equips
[EMAIL PROTECTED]
610.68.41.78 



Re: [fw-general] Zend_Filesystem proposal

2007-02-13 Thread Colin Ross

As far as I have known, there isn't a practical way for php to create/modify
files that are NOT owned by the apache user...

I think this kind of a class would be a great thing for managing assets in
an application, like documents.

I have implemented something like this before, but it was very specialized
(for audio files) with no real ACL or metadata stuff.   I actually just
replaced it with some code ontop of the SPL DirectoryIterator/ etc.

c

On 2/13/07, Xavier Vidal Piera <[EMAIL PROTECTED]> wrote:


Hi

I'm wondering if it can be a good idea to write a Zend class to manage
files inside a special path for our applications.

In short, many times we need to manage files, and we don't want to store
them in the database. Actually, the OS filesystem is the best place to store
files IMHO, so writing a wrapper to let the developers manage files within
the applications could be a useful tool.

The main class could be extended to support different operative systems,
so search facilities and other features can be optimized for each OS.

The main goals of this wrapper:
- search files
- list files from a folder
- read and write files
- search through file contents? (using OS specific functions)
- store metadata somewhere about access permissions to files and folders
(database?, file per folder? store a Zend_Acl?..)

Of course, all the files will belong to the apache user, i don't know
which can be the consequences of this design, but a wrapper could be useful
imho.



--
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
[EMAIL PROTECTED]
610.68.41.78


Re: [fw-general] Code optimizations

2007-02-13 Thread Colin Ross

On top of that last comment by Matthew, it appears as though the cited
article's benchmarks DON't take that into account: the benchmark doesn't
include how much overhead Zend_JSON adds when ext\json is available, which i
think would be nice to have for completeness.

colin

On 2/13/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:


-- Martel Valgoerad <[EMAIL PROTECTED]> wrote
(on Tuesday, 13 February 2007, 10:52 PM +0100):
> David Koblas wrote:
> > Another follow on to optimizations, I noticed that the framework make
> > some very minimal assumptions about what extensions are available,
while
> > that's good for broad compatability it creates big performance
worries.
> >
> > One case in particular:
> >Zend_Json_Encode / Zend_Json_Decode.
> >
> > With php now making json_encode() and json_decode() fairly standard
the
> > performance hit of not calling these when available is quite
substantial
> > -- in one application it was 1.3seconds of decode time vs. 0.02seconds
> > for the builtin version.

Um... The standard way to use Zend_Json is to use Zend_Json::encode()
and Zend_Json::decode(); if you use these and ext/json is installed, it
will use json_encode() and json_decode() instead. So the performance hit
is minimal.

> There are some differences between native php implementation and
Zend_Json.
> Take a peek:
>
> http://gggeek.altervista.org/sw/article_20061113.html

I haven't had a chance to read this, but one place in particular they
differ is their support for objects; ext/json's support for them, well,
doesn't really exist. Zend_Json does offer support for them, but puts in
a security layer, basically preventing you from decoding directly into
an object by only allowing returning an object of type stdClass (and
then only if you explicitly tell it to decode to an object; otherwise it
decodes to an assoc array).

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



Re: [fw-general] Using Zend_DB to connect to MSSQL Server using ODBC

2007-02-13 Thread Rob Allen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Bill Karwin wrote:

> For what it's worth Haddad, so far I have not been able to connect
> Zend_Db to MS SQL Server 2005 Express Edition either.

It works fine for me, using Zend_Db_Adapter_Pdo_Mssql. I had to install
SQL Server 2005 Express edition with no instance though.

Regards,

Rob...
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF0kbI421+qn4cITwRAlnLAJ9ik3th35DZ2EYjdNeeT5hP85oT4ACeKIly
RTPtWz0sIbXtRRQJcrKNtfU=
=k3A0
-END PGP SIGNATURE-


Re: [fw-general] Code optimizations

2007-02-13 Thread Matthew Weier O'Phinney
-- Martel Valgoerad <[EMAIL PROTECTED]> wrote
(on Tuesday, 13 February 2007, 10:52 PM +0100):
> David Koblas wrote:
> > Another follow on to optimizations, I noticed that the framework make 
> > some very minimal assumptions about what extensions are available, while 
> > that's good for broad compatability it creates big performance worries.
> >
> > One case in particular:
> >Zend_Json_Encode / Zend_Json_Decode.
> >
> > With php now making json_encode() and json_decode() fairly standard the 
> > performance hit of not calling these when available is quite substantial 
> > -- in one application it was 1.3seconds of decode time vs. 0.02 seconds 
> > for the builtin version. 

Um... The standard way to use Zend_Json is to use Zend_Json::encode()
and Zend_Json::decode(); if you use these and ext/json is installed, it
will use json_encode() and json_decode() instead. So the performance hit
is minimal.

> There are some differences between native php implementation and Zend_Json.
> Take a peek:
> 
> http://gggeek.altervista.org/sw/article_20061113.html

I haven't had a chance to read this, but one place in particular they
differ is their support for objects; ext/json's support for them, well,
doesn't really exist. Zend_Json does offer support for them, but puts in
a security layer, basically preventing you from decoding directly into
an object by only allowing returning an object of type stdClass (and
then only if you explicitly tell it to decode to an object; otherwise it
decodes to an assoc array).

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


[fw-general] Zend_Mail mime encoding

2007-02-13 Thread Dillon Woods

In Zend_Mail the setBodyText() and setBodyHtml() functions both create a
protected Zend_Mime_Part object and automatically set the encoding to
Zend_Mime::ENCODING_QUOTEDPRINTABLE.  I have a situation where I would like
to send an email with the encoding Zend_Mime::ENCODING_7BIT, but there is
not an exposed way to edit that property.

Would the group in charge of Zend_Mail consider changing the function so
that the encoding could be passed in a third parameter, or is there a better
way to do it?

public function setBodyText($txt, $charset=null, $encoding=null)
{
  if ($charset === null) {
 $charset = $this->_charset;
  }
  if ($encoding === null) {
 $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
  }
  $mp = new Zend_Mime_Part($txt);
  $mp->encoding = $encoding;
  $mp->type = Zend_Mime::TYPE_TEXT;
  $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
  $mp->charset = $charset;

   $this->_bodyText = $mp;
   return $mp;
}

Dillon


Re: [fw-general] Code optimizations

2007-02-13 Thread Martel Valgoerad

David Koblas wrote:

Another follow on to optimizations, I noticed that the framework make 
some very minimal assumptions about what extensions are available, while 
that's good for broad compatability it creates big performance worries.


One case in particular:
Zend_Json_Encode / Zend_Json_Decode.

With php now making json_encode() and json_decode() fairly standard the 
performance hit of not calling these when available is quite substantial 
-- in one application it was 1.3seconds of decode time vs. 0.02 seconds 
for the builtin version. 


There are some differences between native php implementation and Zend_Json.
Take a peek:

http://gggeek.altervista.org/sw/article_20061113.html


--koblas


--
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] Code optimizations

2007-02-13 Thread David Koblas
Another follow on to optimizations, I noticed that the framework make 
some very minimal assumptions about what extensions are available, while 
that's good for broad compatability it creates big performance worries.


One case in particular:
   Zend_Json_Encode / Zend_Json_Decode.

With php now making json_encode() and json_decode() fairly standard the 
performance hit of not calling these when available is quite substantial 
-- in one application it was 1.3seconds of decode time vs. 0.02 seconds 
for the builtin version. 

It would be wise to have the appropriate internal checks to use 
extensions when available...


--koblas


Stéphane Bisinger wrote:

Hi all,
I was wondering if the current code in the Core
section of the framework has been optimized in any
way. I know that this is yet a preview, but it is not
so far from version 1.0.0, so it could be the right
time to think about this kind of issues. I'm telling
you this because using ZF in a large application I
could find some bottlenecks in the framework itself:
for instance, if you load a medium sized ini file with
Zend_Config_Ini, the recursive function calls in the
constructor slows down the application quite a bit. In
particular, if there are a lot of extended sections
the recursion happens for two functions
(Zend_Config_Ini::_processExtends and
Zend_Config_Ini::_processKey ) slowing everything
down.

There are other similar issues around the code which
come up with a simple profiling and I think that
indeed some improvements should be made. What do you
think about it? Is the code mature enough to start
toying with optimizations?
If you feel the time is right, I might have a look
myself.

Best regards,

Stéphane



___ 
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html


  


Re: [fw-general] Zend_Data Proposal

2007-02-13 Thread Markus Wolff

nerVo schrieb:
But in a more advanced way of using ZF for developping web application, 
soon or later, some components like automatic datagrids or automatic 
forms will emerge.

And that's not the only reason.
If you think about it, in most cases, a web application consists in 
manipulating datas from user to database, and from database to user.
But database is not the only data connector in the scene. I think about 
xml, rss, php arrays, csv files, etc...


I was pondering similar things, but I am not really sure if having all 
those adaptors extend from a common base class is the way to go. I'd 
rather define an interface that includes methods most commonly used in 
data retrieval / updating, like search(), save() and the likes... you'd 
also need some means of iterating over the collections, thus a 
collection object returned by, for example a search() method could just 
implement a standard SPL iterator.


What do you think?

CU
 Markus


[fw-general] Code optimizations

2007-02-13 Thread Stéphane Bisinger
Hi all,
I was wondering if the current code in the Core
section of the framework has been optimized in any
way. I know that this is yet a preview, but it is not
so far from version 1.0.0, so it could be the right
time to think about this kind of issues. I'm telling
you this because using ZF in a large application I
could find some bottlenecks in the framework itself:
for instance, if you load a medium sized ini file with
Zend_Config_Ini, the recursive function calls in the
constructor slows down the application quite a bit. In
particular, if there are a lot of extended sections
the recursion happens for two functions
(Zend_Config_Ini::_processExtends and
Zend_Config_Ini::_processKey ) slowing everything
down.

There are other similar issues around the code which
come up with a simple profiling and I think that
indeed some improvements should be made. What do you
think about it? Is the code mature enough to start
toying with optimizations?
If you feel the time is right, I might have a look
myself.

Best regards,

Stéphane



___ 
The all-new Yahoo! Mail goes wherever you go - free your email address from 
your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html


Re: [fw-general] Using Zend_DB to connect to MSSQL Server using ODBC

2007-02-13 Thread Stanislav Malyshev
For example, should this be based on PDO_ODBC?  Or the native ODBC 
extension in PHP?


Well, if we could have both it'd be nice ;) I'm not sure actually which 
one is more important - that depends on what is more widely used and 
what different features each of them has, etc.

But I'm convinced we should have at least one of them for 1.0.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/



Re: [fw-general] Using Zend_DB to connect to MSSQL Server using ODBC

2007-02-13 Thread Bill Karwin

Stanislav Malyshev wrote:
However I don't know exactly how to do it using the Zend Framework as 
there is no class Zend_Db_Adapter_Pdo_Odbc, and I dont want to use 
Zend_Db_Adapter_Pdo_Mssql since the driver uses an old API which 
doesnt seem to allow you using unicode characters with it.


As far as I understand there's currently no adapter for ODBC. I think 
there should be.


Sure, now there's a feature request for an ODBC adapter for Zend_Db.  I 
made the description extremely brief.  If you have more specific 
requirements, please add comments to the following JIRA issue:

http://framework.zend.com/issues/browse/ZF-905

For example, should this be based on PDO_ODBC?  Or the native ODBC 
extension in PHP?


For what it's worth Haddad, so far I have not been able to connect 
Zend_Db to MS SQL Server 2005 Express Edition either.


Regards,
Bill Karwin


Re: [fw-general] Using Zend_DB to connect to MSSQL Server using ODBC

2007-02-13 Thread Stanislav Malyshev
However I don't know exactly how to do it using the Zend Framework as 
there is no class Zend_Db_Adapter_Pdo_Odbc, and I dont want to use 
Zend_Db_Adapter_Pdo_Mssql since the driver uses an old API which doesnt 
seem to allow you using unicode characters with it.


As far as I understand there's currently no adapter for ODBC. I think 
there should be.


--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/



Re: [fw-general] redirecting in plugins

2007-02-13 Thread Uros

I did set this and now I looks like it works. I looks like I have another
problem before, because none (true|false) was working.

thanks anyway 

regards

Uros


Matthew Weier O wrote:
> 
> -- Bartosz Maciaszek <[EMAIL PROTECTED]> wrote
> (on Tuesday, 13 February 2007, 04:58 PM +0100):
>> How about $this->_forward() ?
> 
> That's only possible from within a controller -- he specifically
> mentioned trying to do so from a plugin.
> 
> As I mentioned preiously, he needs to call $request->setDispatched(true).
> 
>> 2007/2/13, Uros <[EMAIL PROTECTED]>:
>> > I need to stay at that page. My implementation actually works but I
>> > can't stop executing controller after redirecting to
>> > ErrorController. So denied page is still shown.
> 
> -- 
> 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/redirecting-in-plugins-tf3219610s16154.html#a8948276
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] redirecting in plugins

2007-02-13 Thread Matthew Weier O'Phinney
-- Bartosz Maciaszek <[EMAIL PROTECTED]> wrote
(on Tuesday, 13 February 2007, 04:58 PM +0100):
> How about $this->_forward() ?

That's only possible from within a controller -- he specifically
mentioned trying to do so from a plugin.

As I mentioned preiously, he needs to call $request->setDispatched(true).

> 2007/2/13, Uros <[EMAIL PROTECTED]>:
> > I need to stay at that page. My implementation actually works but I
> > can't stop executing controller after redirecting to
> > ErrorController. So denied page is still shown.

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


Re: [fw-general] redirecting in plugins

2007-02-13 Thread Bartosz Maciaszek

Hi Uros

How about $this->_forward() ?

Cheers
Bartosz

2007/2/13, Uros <[EMAIL PROTECTED]>:


I need to stay at that page. My implementation actually works but I can't
stop executing controller after redirecting to ErrorController. So denied
page is still shown.

--
View this message in context: 
http://www.nabble.com/redirecting-in-plugins-tf3219610s16154.html#a8942184
Sent from the Zend Framework mailing list archive at Nabble.com.




[fw-general] Using Zend_DB to connect to MSSQL Server using ODBC

2007-02-13 Thread Haddad Said

HI,

I am trying to use Zend_DB to connect to Microsoft SQL Server 2005 (Express
Edition) running on a Windows 2003 server using ODBC.

I have a System Wide DSN configured with the name 'foo', and I have
succesfully connected to it using PDO with the following piece of code


$db = new PDO('odbc:foo', $login, $passwd);

$res = $db->query('SELECT TOP 10 * FROM bar');

echo "" . print_r($res->fetchAll(), 1) . "";


However I don't know exactly how to do it using the Zend Framework as there
is no class Zend_Db_Adapter_Pdo_Odbc, and I dont want to use
Zend_Db_Adapter_Pdo_Mssql since the driver uses an old API which doesnt seem
to allow you using unicode characters with it.

Can someone please provide a bit of help?


Thanks


Haddad


Re: [fw-general] Zend_Data Proposal

2007-02-13 Thread nerVo

I already use Zend_Db_Table, no matter with it, thank you  :)

But in a more advanced way of using ZF for developping web application, 
soon or later, some components like automatic datagrids or automatic 
forms will emerge.

And that's not the only reason.
If you think about it, in most cases, a web application consists in 
manipulating datas from user to database, and from database to user.
But database is not the only data connector in the scene. I think about 
xml, rss, php arrays, csv files, etc...


And for each of these collectors, the process is the same : 
user->collector data, and collector data -> user


So what about unifying all of this mess ?
Every collector might be accessed lonely with its own singularity, but 
all of them can be accessed in a unique pre-formatted way.


If you take my "news" example, i have to implement two very differents 
class, depending of they came from database, or rss.

And i'm not talking about manage them in a datagrid.

I have choosen "Zend_Data" for naming it, because it was the first idea 
which came to me.
Perhaps another world may be better, but what's important is to 
understand the concept.


It's the same goal than Zend_Db with its factorised adapters, instead 
that it works with other datas collectors.
And you can find real examples in some PEAR components, where a class 
take a "source" data component of any kind, treats it, and render it in 
a "renderer" data component.


Do you more understand what i mean ?



Hello nerVo,

I'm not sure I understand what you mean, but I think Zend_Db_Table is 
the thing you should be looking at. Zend_Db_Table is a TableModule for 
the Zend Framework. It connects to your database via Zend_Db_Adapter, 
examines a table for its schema, then aids you in manipulating and 
fetching rows from that table.


I also believe that there's an XML adapter.

Using your sample code you could do:

class News extends Zend_Db_Table
{}

|$news = new News();

$data = array(
   'title' => 'Foo',
   'body'  => 'bar'
)

$id = $news->insert($data);

"Data" is a much too broad subject, which I don't think we should be 
wrapping in a Zend_Data class ... I'd rather use standard PHP 
functions for "data handling".


Best regards,


|



Gecontroleerd op virussen door de JOJO Secure Gateway.
  




[fw-general] Zend_Filesystem proposal

2007-02-13 Thread Xavier Vidal Piera

Hi

I'm wondering if it can be a good idea to write a Zend class to manage files
inside a special path for our applications.

In short, many times we need to manage files, and we don't want to store
them in the database. Actually, the OS filesystem is the best place to store
files IMHO, so writing a wrapper to let the developers manage files within
the applications could be a useful tool.

The main class could be extended to support different operative systems, so
search facilities and other features can be optimized for each OS.

The main goals of this wrapper:
- search files
- list files from a folder
- read and write files
- search through file contents? (using OS specific functions)
- store metadata somewhere about access permissions to files and folders
(database?, file per folder? store a Zend_Acl?..)

Of course, all the files will belong to the apache user, i don't know which
can be the consequences of this design, but a wrapper could be useful imho.



--
Xavier Vidal Piera
Enginyer Tècnic Informàtic de Gestió
Tècnic Especialista Informàtic d'equips
[EMAIL PROTECTED]
610.68.41.78


Re: [fw-general] Zend_Data Proposal

2007-02-13 Thread Andries Seutens


Hello nerVo,

I'm not sure I understand what you mean, but I think Zend_Db_Table is 
the thing you should be looking at. Zend_Db_Table is a TableModule for 
the Zend Framework. It connects to your database via Zend_Db_Adapter, 
examines a table for its schema, then aids you in manipulating and 
fetching rows from that table.


I also believe that there's an XML adapter.

Using your sample code you could do:

class News extends Zend_Db_Table
{}

|$news = new News();

$data = array(
   'title' => 'Foo',
   'body'  => 'bar'
)

$id = $news->insert($data);

"Data" is a much too broad subject, which I don't think we should be 
wrapping in a Zend_Data class ... I'd rather use standard PHP functions 
for "data handling".


Best regards,


|

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

i18n Locale Team is looking for your help.  Volunteers are always welcome to 
contribute their feedback, bug fixes, suggestions for enhancements and 
improvements, experimental patches, and especially their ideas on the fw-i18n 
mail list.

||
nerVo schreef:

Hello,

this morning, i was just thinking about an interesting new ZF concept.
Imagine.
You got a class, let's say "News", which treats news on your website.
Datas for this class may come from everywhere : db, xml, csv, 
The only requisite is that these datas must be indexed (this way, we 
can do searches, inserts, deletes, ...)


Let's go for a schema, you'll quickly understand what i mean :

Zend/
   Data.php
   Data/
  Adapter/
 Abstract.php
 Db.php
 Xml.php
 Config.php
 ...

Abstract.php implements common methods like finding, fetching, 
inserting, updating, deleting, 

Then, every adapter simply implements an existing (or not) ZF elements :
Db.php -> Zend_Db_Table
Xml.php -> Zend_Xml
Config.php -> Zend_Config
...

The code, now :

$news = Zend_Data::factory( $adapter, $config );

or

class News
{
   protected $_data;

   public function __construct($adapter, $config)
   {
  $this->_data = Zend_Data::factory( $adapter, $config );
   }
}

or ...

Three (surely more ) greats aspects of this approach :

1) Totally abstracted and centralized data manipulation
2) We can connect Zend_Data directly to Zend_Form to make all ready 
forms for one or more elements.
3) We can implement a Zend_Datagrid, which take a Zend_Data object for 
source (and render it through Zend_Html_Table, or Zend_Pdf, or 
Zend_Excel, ...)


It sounds good, no ?
Gecontroleerd op virussen door de JOJO Secure Gateway.


[fw-general] Zend_Data Proposal

2007-02-13 Thread nerVo

Hello,

this morning, i was just thinking about an interesting new ZF concept.
Imagine.
You got a class, let's say "News", which treats news on your website.
Datas for this class may come from everywhere : db, xml, csv, 
The only requisite is that these datas must be indexed (this way, we can 
do searches, inserts, deletes, ...)


Let's go for a schema, you'll quickly understand what i mean :

Zend/
   Data.php
   Data/
  Adapter/
 Abstract.php
 Db.php
 Xml.php
 Config.php
 ...

Abstract.php implements common methods like finding, fetching, 
inserting, updating, deleting, 

Then, every adapter simply implements an existing (or not) ZF elements :
Db.php -> Zend_Db_Table
Xml.php -> Zend_Xml
Config.php -> Zend_Config
...

The code, now :

$news = Zend_Data::factory( $adapter, $config );

or

class News
{
   protected $_data;

   public function __construct($adapter, $config)
   {
  $this->_data = Zend_Data::factory( $adapter, $config );
   }
}

or ...

Three (surely more ) greats aspects of this approach :

1) Totally abstracted and centralized data manipulation
2) We can connect Zend_Data directly to Zend_Form to make all ready 
forms for one or more elements.
3) We can implement a Zend_Datagrid, which take a Zend_Data object for 
source (and render it through Zend_Html_Table, or Zend_Pdf, or 
Zend_Excel, ...)


It sounds good, no ?


Re: [fw-general] redirecting in plugins

2007-02-13 Thread Matthew Weier O'Phinney
-- Uros <[EMAIL PROTECTED]> wrote
(on Tuesday, 13 February 2007, 02:18 AM -0800):
> I'm trying to implement authentication with acl and when user is denied I
> need to redirect it to new controller and action.
> 
> I create plugin (called first) and in postDispatch set new controller and
> action. but redirect does not happened. If I set
> $request->setDispatched(false) it loops forever.

Set it to true.

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


Re: [fw-general] redirecting in plugins

2007-02-13 Thread Uros

I need to stay at that page. My implementation actually works but I can't
stop executing controller after redirecting to ErrorController. So denied
page is still shown.

-- 
View this message in context: 
http://www.nabble.com/redirecting-in-plugins-tf3219610s16154.html#a8942184
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] redirecting in plugins

2007-02-13 Thread Pet Tau

Hi Uros,


$this->_response->setRedirect( "/xxx" );
this->_response->sendResponse();
exit;

Just wrote this today; dunno if it's the "accepted method" since it 
breaks/kills the program flow.  For my needs, it works fine.


Cheers,

Pet

Uros wrote:

Hi,

I'm trying to implement authentication with acl and when user is denied I
need to redirect it to new controller and action.

I create plugin (called first) and in postDispatch set new controller and
action. but redirect does not happened. If I set
$request->setDispatched(false) it loops forever.

Is there anything I need to know?

regards
  




[fw-general] redirecting in plugins

2007-02-13 Thread Uros

Hi,

I'm trying to implement authentication with acl and when user is denied I
need to redirect it to new controller and action.

I create plugin (called first) and in postDispatch set new controller and
action. but redirect does not happened. If I set
$request->setDispatched(false) it loops forever.

Is there anything I need to know?

regards
-- 
View this message in context: 
http://www.nabble.com/redirecting-in-plugins-tf3219610s16154.html#a8941347
Sent from the Zend Framework mailing list archive at Nabble.com.