RE: [fw-general] DB_TABLE - Fetching references

2007-08-23 Thread Bill Karwin
> -Original Message-
> From: Ian Warner [mailto:[EMAIL PROTECTED] 
> is this correct - what are the overheads of doing this - is 
> it doing more queries to find the references?

Yes.  It executes a separate query to get the parent row or dependent
rowset for each row of the base table.

> I just thought i did a query and the references create the 
> joins and the results are returned to me in a nice package :)

No, the references do not generate queries with joins.  Keep in mind
that Zend_Db_Table is always an object mapping to a *single* table.  It
does not model joined result sets.  

Keep in mind that the table-relationships methods are operations in the
context of a *row*, not a table.  In other words, "given the current
row, find for me the row to which it refers in its parent table."

Once I have fetched a row from the Players table, and I want the row
from the Teams table that the Player row references, it doesn't make
sense to do a join of Players to Teams.  Zend_Db_Table_Row uses the
value of the foreign key in the Player row, and uses that value to find
the appropriate row from Teams with that value in its primary key.  No
join is necessary, and it would be wasteful to do one.

If you do want to do a join, you should write a SQL query and execute it
with methods of the Zend_Db_Adapter object.

Regards,
Bill Karwin


AW: [fw-general] Is there allready some kind of zf-create script ?

2007-08-23 Thread Leo Büttiker
Hi Steven,
Great idea we currently think about a scaffolding-script by ourselv. Not
shure if we gone ever realize this, but I would be very intrested in your
work. Hopfully you can publish your script, probably its even a topic for a
proposal at zend.
Cheers
leo

-Ursprüngliche Nachricht-
Von: Truppe Steven [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 24. August 2007 02:31
An: fw-general@lists.zend.com
Betreff: [fw-general] Is there allready some kind of zf-create script ?

Hi again,

i wonder if there is a script that creates the basic directory structure
and files needed for every new zend project.

i think this would be a nice feature (when it can get a bit customized
so that the user can set the structure like he wants and the script does
the needed stuff for the bootstrap file!)

i haven't found such a tool yet so i start writing one, at the moment
only for my personal education,
i hope this will help some people getting started with the zend
framework much faster.

maybe someone finds the idea interessting and reply to this message.





best regards,
Truppe Steven



AW: [fw-general] Question about module urls with default settings

2007-08-23 Thread Leo Büttiker
Hi Steven,
You have to set a route for this:
//Set and configure router
$router = $front->getRouter();
$route = new Trevi_Controller_Router(
':module/:controller/:action/*',
array('module' => 'Home')
);
$router->addRoute('default', $route);

Ohmm, you have to use the Zend Route (something like
Zend_Router_Rewrite_Route), we just write our own to solve one more
use-case.

And you have to set the path specification (I think you dont have to do
this, if you make your folderstructor like in the documentation):

$viewRenderer->setViewScriptPathSpec('views/:module/:controller/:action.:suf
fix')

Hopfully thats what you searching for
Cheers,
leo


Von: Truppe Steven [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 24. August 2007 01:43
An: fw-general@lists.zend.com
Betreff: [fw-general] Question about module urls with default settings

What do i need to set in order to not route urls like :component :method but
:module :component :method ?

The default route is set with run('../application/controllers'); so i
thought to replace this with:

$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array(
                'default' => '../application/modules/default',
                'projects' => '../application/modules/projects/controllers',
                'shop' => '../application/modules/projects/controllers'));

to set the default path for the viewRenderer i also add:
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setViewBasePathSpec('../application/views');

so i have application/views/shop for shop templates and
application/view/admin for admin templates.

But how to tell the default router to use :module :controller :component
:parameter
so i have urls like domain.tld/shop/list/by-data or
domain.tld/admin/user/login ?

I allways get "Invalid Controller (index)" if i specify an module name in
the url, when i enter something else for module (something not defined with
setControllerDirecoty) i get 
"Invalid Controller (notamodule)".

What am i doing wrong ?


Matthew Weier O'Phinney wrote: 
-- Truppe Steven <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 09:13 PM +0200):
  
I can't tell you how happy i am about this few lines of code =)

Thank you very much!!


My pleasure! I foresaw exactly this sort of situation when I was
developing the ViewRenderer originally -- in part because I was already
working on a project that would need to do so. :-)

  
I must say that the zend framework is far the best web framework i've
seen. It takes havy load of the programmer and so makes it easy to write
full featured web applications in short time.


I'm glad it's fitting your needs! 

  
You work at Zend or as a freelancer ?


Full-time employee. I've been with Zend for almost 2 years now, and am
transitioning from our online operations team to working full time on
the framework team.


  
Matthew Weier O'Phinney wrote:

-- steven truppe <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 08:30 PM +0200):
  
  
My main understanding problem is how to make ViewRenderer use the  
Smarty_View instead of Zend_View, so i can work with the ViewRenderer.

or should i turn the ViewRenderer off and make my own  
Zend_Controller_Action_Helper that creates the smarty view instanzes for  
the controllers ?
the first method would be the best practice i think...

hope someone can help a beginner with a few understanding problems.. it  
needs a bit time to realise all core components of the framework.


No problem -- that's part of my job!

You can actually get the ViewRenderer to use your custom view class
easily. Do the following in your bootstrap:

$view = new Smarty_View();
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setView($view);

and that's all there is to it; when the ViewRenderer is invoked in
controllers, it will use the view object you've provided.

  
  
On Thu, 23 Aug 2007 20:08:12 +0200, Matthew Weier O'Phinney  
<[EMAIL PROTECTED]> wrote:



-- steven truppe <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 07:40 PM +0200):
  
  
i'm new to the zend framework and try to get the smarty wrapper from the
documentation work with the ViewRenderer helper that is used per  
default.

I want the same behavious for dispatching and finding view scripts, i  
just
want to render with Smarty_View instead of Zend_View so i don't have to
create the view each time in the controller.


I'm doing this now for a project. The main thing is that your Zend_View
Smarty wrapper needs to provide the full path to the file -- smarty
likes all templates to be in the same tree, instead of scattered across
multiple trees, but allows you to get around this with full paths.

  
  
L

Re: [fw-general] DB_TABLE - Fetching references

2007-08-23 Thread Ian Warner

LOL second email that seems to work straight after I post:

// Lookup in the database Players that fit this word
$table  = new sites_lovefootball_models_Players();
$where  = 'MATCH (fname,sname) AGAINST ("Dean")';
$rowset = $table->fetchAll($where);

$row  = $rowset->current();
$team = $row->findParentsites_lovefootball_models_Teams();
$team = 
$row->findParentsites_lovefootball_models_Positions();


Ok it seems I need to then run

foreach ($rowset as $row ) {
$row  = $rowset->current();
$team = $row->findParentsites_lovefootball_models_Teams();
$team = 
$row->findParentsites_lovefootball_models_Positions();

}

is this correct - what are the overheads of doing this - is it doing 
more queries to find the references?


I just thought i did a query and the references create the joins and the 
results are returned to me in a nice package :)


Cheers

Ian

Ian Warner wrote:

Ok now Im confused:

Basically my players table has a TeamID and a PositionID foreign key

// Lookup in the database Players that fit this word
$table  = new sites_lovefootball_models_Players();
$where  = 'MATCH (fname,sname) AGAINST ("Dean")';
$rowset = $table->fetchAll($where);

// Do i need to run these in a loop ?

$row= $rowset->current();
$team = 
$row->findParentRow('sites_lovefootball_models_Teams');


I have declared the ref map and dependant tables in the right classes

protected $_referenceMap = array(
'Team' => array(
'columns'   => 'team_id',
'refTableClass' => 'sites_lovefootball_models_Teams',
'refColumns'=> 'team_id'
),
'Position' => array(
'columns'   => 'position_id',
'refTableClass' => 'sites_lovefootball_models_Positions',
'refColumns'=> 'position_id'
)
);

I want to get when i search the table the references - I thought it did 
this automatically instead i am still getting:


[_data:protected] => Array
(
[player_id] => 21
[team_id] => 19
[position_id] => 4
[fname] => Dean
[sname] => Ashton
[value] => 9
)

When I want
[_data:protected] => Array
(
[player_id] => 21
[team_id] => Sheffield United
[position_id] => Forward
[fname] => Dean
[sname] => Ashton
[value] => 9
)

Is this possible for all returned data?



[fw-general] DB_TABLE - Fetching references

2007-08-23 Thread Ian Warner

Ok now Im confused:

Basically my players table has a TeamID and a PositionID foreign key

// Lookup in the database Players that fit this word
$table  = new sites_lovefootball_models_Players();
$where  = 'MATCH (fname,sname) AGAINST ("Dean")';
$rowset = $table->fetchAll($where);

// Do i need to run these in a loop ?

$row= $rowset->current();
$team = 
$row->findParentRow('sites_lovefootball_models_Teams');


I have declared the ref map and dependant tables in the right classes

protected $_referenceMap = array(
'Team' => array(
'columns'   => 'team_id',
'refTableClass' => 'sites_lovefootball_models_Teams',
'refColumns'=> 'team_id'
),
'Position' => array(
'columns'   => 'position_id',
'refTableClass' => 'sites_lovefootball_models_Positions',
'refColumns'=> 'position_id'
)
);

I want to get when i search the table the references - I thought it did 
this automatically instead i am still getting:


[_data:protected] => Array
(
[player_id] => 21
[team_id] => 19
[position_id] => 4
[fname] => Dean
[sname] => Ashton
[value] => 9
)

When I want
[_data:protected] => Array
(
[player_id] => 21
[team_id] => Sheffield United
[position_id] => Forward
[fname] => Dean
[sname] => Ashton
[value] => 9
)

Is this possible for all returned data?


Re: [fw-general] Zend_DB_Table emulate this query

2007-08-23 Thread Ian Warner

Ignore this:

try {

// Lookup in the database Players that fit this word
$table = new sites_lovefootball_models_Players();
$where = 'MATCH (fname,sname) AGAINST ("Ashton")';
$row   = $table->fetchRow($where);

echo ''; print_r($row); echo '';

} catch (Exception $e) {
echo 'Failed: ' . $e->getMessage();
}

Ian Warner wrote:

Hi

Is it possible to emulate this in Zend_DB_Table:

SELECT A.team, B.fname, B.sname
FROM `teams` A, `players` B
WHERE MATCH (B.fname,B.sname) AGAINST ('Derby')
AND A.team_id = B.team_id;

So I have a join here and also some MySQL keywords, I have relations set 
up in my objects


Cheers

Ian



[fw-general] Zend_DB_Table emulate this query

2007-08-23 Thread Ian Warner

Hi

Is it possible to emulate this in Zend_DB_Table:

SELECT A.team, B.fname, B.sname
FROM `teams` A, `players` B
WHERE MATCH (B.fname,B.sname) AGAINST ('Derby')
AND A.team_id = B.team_id;

So I have a join here and also some MySQL keywords, I have relations set 
up in my objects


Cheers

Ian


Re: [fw-general] zend auth session timeout

2007-08-23 Thread Tony Ford




True, in which case you can use "save_path" when you create the session
object and avoid that issue. That is, if you are allowed to use
ini_set(), which you'll need to set any of these options. Or, if you
have access to the php.ini then you just set them all there.

 - Tony

On 8/23/2007 2:25 PM, Gunter Sammet wrote:

  As a side not to garbage collection: IIRC, if you are on a shared server or
have another app that shares the same session directroy, the application
with the shortest lifetime determines it.
HTH

G.


On 8/23/07, Tony Ford <[EMAIL PROTECTED]> wrote:
  
  
 It doesn't really matter what you set that to if the entire session
expires. You need to take a look at these settings:

cookie_lifetime
gc_maxlifetime

If cookie lifetime is set to 0 then any session will expire when all
browser windows are closed. If set less than 24 hours, obviously the session
cookie will expire as well.

gc max lifetime can be a little tricky. The session garbage collector goes
out and removes sessions that have not been active for greater than gc max
lifetime. Therefore, if gc max lifetime is set less than 24 hours, a session
has the potential to be removed from the servers before 24 hours. For
instance, let's say gc max life time is set to 4 hours. That means, if I
have a period of inactivity for ~ 4 hours (it depends upon how probability
and divisor are set), even if I haven't closed my browser, the garbage
collector will clean up my session on the server, so my next request will no
longer have a valid session.

 - Tony

On 8/23/2007 10:55 AM, Raul Andres Gomez Quijano wrote:

  // Set Auth Session Expiration to 24 hours
  //
  $objSessionNamespace = new Zend_Session_Namespace( 'Zend_Auth' );
  $objSessionNamespace->setExpirationSeconds( 86400 );

it isnt working, zend auth session expires early...

thanks in advance.


--
This message contains confidential information and is intended only for
the individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message, which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version.



  
  
  






[fw-general] Is there allready some kind of zf-create script ?

2007-08-23 Thread Truppe Steven
Hi again,

i wonder if there is a script that creates the basic directory structure
and files needed for every new zend project.

i think this would be a nice feature (when it can get a bit customized
so that the user can set the structure like he wants and the script does
the needed stuff for the bootstrap file!)

i haven't found such a tool yet so i start writing one, at the moment
only for my personal education,
i hope this will help some people getting started with the zend
framework much faster.

maybe someone finds the idea interessting and reply to this message.





best regards,
Truppe Steven


[fw-general] Zend_Search_Lucene Storage Private Properties

2007-08-23 Thread Carl Vondrick
Hello,
In Zend_Search_Lucene_Storage_File_Filesystem and 
Zend_Search_Lucene_Storage_Directory_Filesystem, the properties are private.  
Is there a reason for this?  It makes extending these two classes quite 
tedious, especially when I only need to change one method!

Carl


[fw-general] Question about module urls with default settings

2007-08-23 Thread Truppe Steven




What do i need to set in order to not route urls like :component
:method but :module :component :method ?

The default route is set with run('../application/controllers');
so i thought to replace this with:

$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array(
                'default' => '../application/modules/default',
                'projects' =>
'../application/modules/projects/controllers',
                'shop' =>
'../application/modules/projects/controllers'));

to set the default path for the viewRenderer i also add:
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setViewBasePathSpec('../application/views');

so i have application/views/shop for shop templates and
application/view/admin for admin templates.

But how to tell the default router to use :module :controller
:component :parameter
so i have urls like domain.tld/shop/list/by-data or
domain.tld/admin/user/login ?

I allways get "Invalid Controller (index)" if i specify an module name
in the url, when i enter something else for module (something not
defined with setControllerDirecoty) i get 
"Invalid Controller (notamodule)".

What am i doing wrong ?


Matthew Weier O'Phinney wrote:

  -- Truppe Steven <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 09:13 PM +0200):
  
  
I can't tell you how happy i am about this few lines of code =)

Thank you very much!!

  
  
My pleasure! I foresaw exactly this sort of situation when I was
developing the ViewRenderer originally -- in part because I was already
working on a project that would need to do so. :-)

  
  
I must say that the zend framework is far the best web framework i've
seen. It takes havy load of the programmer and so makes it easy to write
full featured web applications in short time.

  
  
I'm glad it's fitting your needs! 

  
  
You work at Zend or as a freelancer ?

  
  
Full-time employee. I've been with Zend for almost 2 years now, and am
transitioning from our online operations team to working full time on
the framework team.


  
  
Matthew Weier O'Phinney wrote:


  -- steven truppe <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 08:30 PM +0200):
  
  
  
My main understanding problem is how to make ViewRenderer use the  
Smarty_View instead of Zend_View, so i can work with the ViewRenderer.

or should i turn the ViewRenderer off and make my own  
Zend_Controller_Action_Helper that creates the smarty view instanzes for  
the controllers ?
the first method would be the best practice i think...

hope someone can help a beginner with a few understanding problems.. it  
needs a bit time to realise all core components of the framework.


  
  No problem -- that's part of my job!

You can actually get the ViewRenderer to use your custom view class
easily. Do the following in your bootstrap:

$view = new Smarty_View();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setView($view);

and that's all there is to it; when the ViewRenderer is invoked in
controllers, it will use the view object you've provided.

  
  
  
On Thu, 23 Aug 2007 20:08:12 +0200, Matthew Weier O'Phinney  
<[EMAIL PROTECTED]> wrote:




  -- steven truppe <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 07:40 PM +0200):
  
  
  
i'm new to the zend framework and try to get the smarty wrapper from the
documentation work with the ViewRenderer helper that is used per  
default.

I want the same behavious for dispatching and finding view scripts, i  
just
want to render with Smarty_View instead of Zend_View so i don't have to
create the view each time in the controller.


  
  I'm doing this now for a project. The main thing is that your Zend_View
Smarty wrapper needs to provide the full path to the file -- smarty
likes all templates to be in the same tree, instead of scattered across
multiple trees, but allows you to get around this with full paths.

  
  
  
Later it may be interesting to change the dispatch process to limit the
possible urls to only valid ones, this should be done in the bootstrap
file in general.. or am i wrong ?


  
  That's what the ErrorHandler plugin is for -- it's basically a 404
handler (controller or action does not exist => forwards to error
handler).
  
  

  

  

  
  
  






Re: [fw-general] zend auth session timeout

2007-08-23 Thread Gunter Sammet
As a side not to garbage collection: IIRC, if you are on a shared server or
have another app that shares the same session directroy, the application
with the shortest lifetime determines it.
HTH

G.


On 8/23/07, Tony Ford <[EMAIL PROTECTED]> wrote:
>
>  It doesn't really matter what you set that to if the entire session
> expires. You need to take a look at these settings:
>
> cookie_lifetime
> gc_maxlifetime
>
> If cookie lifetime is set to 0 then any session will expire when all
> browser windows are closed. If set less than 24 hours, obviously the session
> cookie will expire as well.
>
> gc max lifetime can be a little tricky. The session garbage collector goes
> out and removes sessions that have not been active for greater than gc max
> lifetime. Therefore, if gc max lifetime is set less than 24 hours, a session
> has the potential to be removed from the servers before 24 hours. For
> instance, let's say gc max life time is set to 4 hours. That means, if I
> have a period of inactivity for ~ 4 hours (it depends upon how probability
> and divisor are set), even if I haven't closed my browser, the garbage
> collector will clean up my session on the server, so my next request will no
> longer have a valid session.
>
>  - Tony
>
> On 8/23/2007 10:55 AM, Raul Andres Gomez Quijano wrote:
>
>   // Set Auth Session Expiration to 24 hours
>   //
>   $objSessionNamespace = new Zend_Session_Namespace( 'Zend_Auth' );
>   $objSessionNamespace->setExpirationSeconds( 86400 );
>
> it isnt working, zend auth session expires early...
>
> thanks in advance.
>
>
> --
> This message contains confidential information and is intended only for
> the individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and delete
> this e-mail from your system. E-mail transmission cannot be guaranteed to be
> secure or error-free as information could be intercepted, corrupted, lost,
> destroyed, arrive late or incomplete, or contain viruses. The sender
> therefore does not accept liability for any errors or omissions in the
> contents of this message, which arise as a result of e-mail transmission. If
> verification is required please request a hard-copy version.
>
>


Re: [fw-general] zend auth session timeout

2007-08-23 Thread Tony Ford




It doesn't really matter what you set that to if the entire session
expires. You need to take a look at these settings:

cookie_lifetime
gc_maxlifetime

If cookie lifetime is set to 0 then any session will expire when all
browser windows are closed. If set less than 24 hours, obviously the
session cookie will expire as well.

gc max lifetime can be a little tricky. The session garbage collector
goes out and removes sessions that have not been active for greater
than gc max lifetime. Therefore, if gc max lifetime is set less than 24
hours, a session has the potential to be removed from the servers
before 24 hours. For instance, let's say gc max life time is set to 4
hours. That means, if I have a period of inactivity for ~ 4 hours (it
depends upon how probability and divisor are set), even if I haven't
closed my browser, the garbage collector will clean up my session on
the server, so my next request will no longer have a valid session.

 - Tony

On 8/23/2007 10:55 AM, Raul Andres Gomez Quijano wrote:

  
  
    // Set Auth Session Expiration to
24 hours
  //
  $objSessionNamespace = new Zend_Session_Namespace( 'Zend_Auth' );
  $objSessionNamespace->setExpirationSeconds( 86400 );
   
  it
isnt working, zend auth session expires early...
   
  thanks
in advance.
   
  
  
  This message contains
confidential information and is intended only for the individual named.
If you are not the named addressee you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately by
e-mail if you have received this e-mail by mistake and delete this
e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or omissions
in the contents of this message, which arise as a result of e-mail
transmission. If verification is required please request a hard-copy
version.
  






[fw-general] zend auth session timeout

2007-08-23 Thread Raul Andres Gomez Quijano
  // Set Auth Session Expiration to 24 hours
  //
  $objSessionNamespace = new Zend_Session_Namespace( 'Zend_Auth' );
  $objSessionNamespace->setExpirationSeconds( 86400 );

it isnt working, zend auth session expires early...

thanks in advance.



This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. E-mail transmission cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. The sender therefore 
does not accept liability for any errors or omissions in the contents of this 
message, which arise as a result of e-mail transmission. If verification is 
required please request a hard-copy version.


Re: [fw-general] comments in Zend conf.ini file

2007-08-23 Thread Ralph Schindler
This is not the ini format, you are tring to merge the ini format and 
the array format, you need to do one or the other.  To use ini, it would 
look like this:


ldap.option.host = "10.78.165.44"
ldap.option.bind_dn = "cn=LDAPUser,OU=Users,DC=example,DC=com"

or if you wanted to use "sections"

[ldap]
options.host = "10.78.165.44"
options.bind_dn = "cn=LDAPUser,OU=Users,DC=example,DC=com"


-ralph

Kexiao Liao wrote:

I try to use Zend_Config_Ini to parse following option array into Zend
Configuration class, it fails to read 
this line: 'host'=>'10.11.111.22'

[ldap]  
ldap.option = array(
'host'=>'10.78.165.44',  //server IP,
mandatory
'bind_dn'=>'cn=LDAPUser,OU=Users,DC=example,DC=com', //DN of the user
that may browse the ldap
'bind_pw'=>'xxx',//password
'user_oc'=>'user',   //ObjectClass for
users
'base_dn'=>'DC=example,DC=com',  //base DN for all
users
'user_dn'=>'OU=Users',   //dn for users
'user_attr'=>'samAccountName',   //the attribute
that contains the user login
//AD options
'use_domain_from_email'=>false,  //username is an
email, split it to get the domain
'domain'=>'',//NT domain to
prepend to the username, this is used with the direct_ bind on AD
'use_direct_bind'=>false //force the auth
based only on binding by username and password provided by user
)

tfk wrote:

On 8/23/07, Kexiao Liao <[EMAIL PROTECTED]> wrote:


Can we put comments in the Zend Configuration file(conf.ini) as showing
below?

Yes!

http://de3.php.net/manual/en/function.parse-ini-file.php

Till








Re: [fw-general] comments in Zend conf.ini file

2007-08-23 Thread Kexiao Liao

I try to use Zend_Config_Ini to parse following option array into Zend
Configuration class, it fails to read 
this line: 'host'=>'10.11.111.22'
[ldap]  
ldap.option = array(
'host'=>'10.78.165.44',  //server IP,
mandatory
'bind_dn'=>'cn=LDAPUser,OU=Users,DC=example,DC=com', //DN of the user
that may browse the ldap
'bind_pw'=>'xxx',//password
'user_oc'=>'user',   //ObjectClass for
users
'base_dn'=>'DC=example,DC=com',  //base DN for all
users
'user_dn'=>'OU=Users',   //dn for users
'user_attr'=>'samAccountName',   //the attribute
that contains the user login
//AD options
'use_domain_from_email'=>false,  //username is an
email, split it to get the domain
'domain'=>'',//NT domain to
prepend to the username, this is used with the direct_ bind on AD
'use_direct_bind'=>false //force the auth
based only on binding by username and password provided by user
)

tfk wrote:
> 
> On 8/23/07, Kexiao Liao <[EMAIL PROTECTED]> wrote:
>>
>>
>> Can we put comments in the Zend Configuration file(conf.ini) as showing
>> below?
> 
> Yes!
> 
> http://de3.php.net/manual/en/function.parse-ini-file.php
> 
> Till
> 
> 

-- 
View this message in context: 
http://www.nabble.com/comments-in-Zend-conf.ini-file-tf4319165s16154.html#a12300089
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] comments in Zend conf.ini file

2007-08-23 Thread Ralph Schindler
And there is a nice little undocumented feature that allows for CONST 
replacement and Global Var replacement, like so:


like this:

;; Cache settings
cache.use   = true
cache.path  = APPLICATION_PATH "variable/cache/"

OR this:

;; SESSION SETUP
session.name= "SANDBOX2"
session.save_path   = ";777;" 
${DOCUMENT_ROOT} "/../application/variable/sessions/"




till wrote:

On 8/23/07, Kexiao Liao <[EMAIL PROTECTED]> wrote:


Can we put comments in the Zend Configuration file(conf.ini) as showing
below?


Yes!

http://de3.php.net/manual/en/function.parse-ini-file.php

Till





Re: [fw-general] comments in Zend conf.ini file

2007-08-23 Thread till
On 8/23/07, Kexiao Liao <[EMAIL PROTECTED]> wrote:
>
>
> Can we put comments in the Zend Configuration file(conf.ini) as showing
> below?

Yes!

http://de3.php.net/manual/en/function.parse-ini-file.php

Till


[fw-general] comments in Zend conf.ini file

2007-08-23 Thread Kexiao Liao


Can we put comments in the Zend Configuration file(conf.ini) as showing
below?

//these are the config settings, needed to connect the the LDAP directory
[ldap]  
ldap.options = array(
'host'=>'xx.xx.xxx.xx',  //server IP,
mandatory
'bind_dn'=>'cn=LDAPUser,OU=Users,DC=example,DC=com', //DN of the user
that may browse the ldap
'bind_pw'=>'xxx',//password
'user_oc'=>'user',   //ObjectClass for
users
'base_dn'=>'DC=example,DC=com',  //base DN for all
users
'user_dn'=>'OU=Users',   //dn for users
'user_attr'=>'samAccountName',   //the attribute
that contains the user login
//AD options
'use_domain_from_email'=>false,  //username is an
email, split it to get the domain
'domain'=>'',//NT domain to
prepend to the username, this is used with the direct_ bind on AD
'use_direct_bind'=>false //force the auth
based only on binding by username and password provided by user
)
-- 
View this message in context: 
http://www.nabble.com/comments-in-Zend-conf.ini-file-tf4319165s16154.html#a12299334
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Controller called inside controller for header/footer/menu purposes

2007-08-23 Thread agatone

> Maybe it's wrong approach - but what i wanna achive is to somehow run
> certain VIEW script with certain controller action. 
With this part I meant I had in mind to use same Controller-Action on few
different templates (like if I have different headers/footers)

Thank you, I'll give it a test in practice. 



Matthew Weier O'Phinney-3 wrote:
> 
> -- agatone <[EMAIL PROTECTED]> wrote
> (on Thursday, 23 August 2007, 09:58 AM -0700):
>> Since I wanna have header, footer, menu includes etc. and I notice quite
>> few
>> problems and posts around it.
>> I found that view script can be included nicely inside other view script
>> (can say news) with render('index/header.phtml') ?>
>> 
>> This is quite what i need(not completly), because i can also assign some
>> variables that are in header.phtml directly from current running action -
>> listAction.
>> 
>> I made also controller _Include_HeaderController with one action Index
>> which
>> should assign all that common variables inside header.phtml (if user is
>> logged - his name, date etc.)
>> 
>> But now i don't know how to run that header controller action inside my
>> news
>> action so it would normaly assign view variables.
> 
> Don't do this. Use an action helper or a preDispatch() plugin instead to
> do the injection. For instance, you could have an action helper like
> this one:
> 
> class My_Helper_Header extends Zend_Controller_Action_Helper_Abstract
> {
> public function preDispatch()
> {
> $this->direct();
> }
> 
> public function direct()
> {
> $view =
> Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
> $view->header_meta = '...';
> $view->header_css  = '...';
> // etc.
> }
> }
> 
> Then, in your bootstrap:
> 
> Zend_Controller_Action_HelperBroker::addHelper(new
> My_Helper_Header());
> 
> The point being, this will do it automatically for you, and doesn't
> require dispatching another controller action.
> 
>> Maybe it's wrong approach - but what i wanna achive is to somehow run
>> certain VIEW script with certain controller action.
> 
> That can be done already; the ViewRenderer, which is on by default,
> automatically renders the view script /.phtml.
> 
> BTW, what you're trying to do will be addressed for 1.1.0 with the
> addition of placeholders and layout support.
> 
> -- 
> 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/Controller-called-inside-controller-for-header-footer-menu-purposes-tf4318722s16154.html#a12299261
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Session - problem with illegal session ids, might be a larger general php issue

2007-08-23 Thread Tony Ford




Recently our company started scanning a new ZF based site we just
launched. It's some sort of security scanner that checks for things
like sql injection, XSS, etc. Anyway, it presented a problem with
sessions that I've never encountered before. This scanner, for whatever
reason, resets all cookie values to some weird uri. So now, instead of
the session cookie looking like:

e3200af3b875e6c78e916e49c6acc315

it looks like:

http://example.com/some.html

The uri obviously has characters like ':' and '/', which are of course
illegal characters for a session id. The problem? First of all, this
throws a Zend_Session_Exception, example:

[21-Aug-2007 15:05:50] PHP Fatal error: Uncaught exception
'Zend_Session_Exception' with message 'Zend_Session::start() -
session_start(): The session id contains illegal characters, valid
characters are a-z, A-Z, 0-9 and '-,'' in
/z/applib/lib/Zend/Session.php:379
Stack trace:
#0 /z/applib/app/bootstrap.php(72): Zend_Session::start()
#1 /z/www/obscurity_network/app/networkbootstrap.php(53):
require('/z/applib/app/b...')
#2 /z/www/obscurity.obscurity.com/index.php(9):
require('/z/www/obscurity_net...')
#3 {main}
thrown in /z/applib/lib/Zend/Session.php on line 379

Secondly though, the reason this happens in the first place, php
actually throws a warning when a session id contains illegal
characters. Example:

Warning: session_start() [function.session-start]:
The session id contains illegal characters, valid characters are a-z,
A-Z, 0-9 and '-,' in /obscurity.php on line 88

What do you guys think? In my opinion, the session extension should
gracefully handle this without a warning. Then again, cookies can be
considered user input, therefore should be filtered ... I dunno. At the
very least, something should be added to the Zend_Session start()
method to check the session id before session_start() is called. At
most, a bug report should be filed at php.net to change the behavior of
the warning.

I'm willing to help however I can, but wanted some opinions first.
(BTW, running php 5.2.2)

Regards,
Tony







Re: [fw-general] Question about the Controller Helper ViewRenderer

2007-08-23 Thread Matthew Weier O'Phinney
-- steven truppe <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 07:40 PM +0200):
> i'm new to the zend framework and try to get the smarty wrapper from the  
> documentation work with the ViewRenderer helper that is used per default.
> 
> I want the same behavious for dispatching and finding view scripts, i just  
> want to render with Smarty_View instead of Zend_View so i don't have to  
> create the view each time in the controller.

I'm doing this now for a project. The main thing is that your Zend_View
Smarty wrapper needs to provide the full path to the file -- smarty
likes all templates to be in the same tree, instead of scattered across
multiple trees, but allows you to get around this with full paths.

> Later it may be interesting to change the dispatch process to limit the  
> possible urls to only valid ones, this should be done in the bootstrap  
> file in general.. or am i wrong ?

That's what the ErrorHandler plugin is for -- it's basically a 404
handler (controller or action does not exist => forwards to error
handler).

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


Re: [fw-general] Controller called inside controller for header/footer/menu purposes

2007-08-23 Thread Matthew Weier O'Phinney
-- agatone <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 09:58 AM -0700):
> Since I wanna have header, footer, menu includes etc. and I notice quite few
> problems and posts around it.
> I found that view script can be included nicely inside other view script
> (can say news) with render('index/header.phtml') ?>
> 
> This is quite what i need(not completly), because i can also assign some
> variables that are in header.phtml directly from current running action -
> listAction.
> 
> I made also controller _Include_HeaderController with one action Index which
> should assign all that common variables inside header.phtml (if user is
> logged - his name, date etc.)
> 
> But now i don't know how to run that header controller action inside my news
> action so it would normaly assign view variables.

Don't do this. Use an action helper or a preDispatch() plugin instead to
do the injection. For instance, you could have an action helper like
this one:

class My_Helper_Header extends Zend_Controller_Action_Helper_Abstract
{
public function preDispatch()
{
$this->direct();
}

public function direct()
{
$view = 
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
$view->header_meta = '...';
$view->header_css  = '...';
// etc.
}
}

Then, in your bootstrap:

Zend_Controller_Action_HelperBroker::addHelper(new My_Helper_Header());

The point being, this will do it automatically for you, and doesn't
require dispatching another controller action.

> Maybe it's wrong approach - but what i wanna achive is to somehow run
> certain VIEW script with certain controller action.

That can be done already; the ViewRenderer, which is on by default,
automatically renders the view script /.phtml.

BTW, what you're trying to do will be addressed for 1.1.0 with the
addition of placeholders and layout support.

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


[fw-general] Question about the Controller Helper ViewRenderer

2007-08-23 Thread steven truppe


Hello,

i'm new to the zend framework and try to get the smarty wrapper from the  
documentation work with the ViewRenderer helper that is used per default.


I want the same behavious for dispatching and finding view scripts, i just  
want to render with Smarty_View instead of Zend_View so i don't have to  
create the view each time in the controller.


Later it may be interesting to change the dispatch process to limit the  
possible urls to only valid ones, this should be done in the bootstrap  
file in general.. or am i wrong ?


best regards,
Truppe Steven


[fw-general] Controller called inside controller for header/footer/menu purposes

2007-08-23 Thread agatone

Since I wanna have header, footer, menu includes etc. and I notice quite few
problems and posts around it.
I found that view script can be included nicely inside other view script
(can say news) with render('index/header.phtml') ?>

This is quite what i need(not completly), because i can also assign some
variables that are in header.phtml directly from current running action -
listAction.

I made also controller _Include_HeaderController with one action Index which
should assign all that common variables inside header.phtml (if user is
logged - his name, date etc.)

But now i don't know how to run that header controller action inside my news
action so it would normaly assign view variables.

Maybe it's wrong approach - but what i wanna achive is to somehow run
certain VIEW script with certain controller action.
-- 
View this message in context: 
http://www.nabble.com/Controller-called-inside-controller-for-header-footer-menu-purposes-tf4318722s16154.html#a12297598
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Encryption and Decryption

2007-08-23 Thread Bill Karwin
I'd like to recommend that you should not store passwords in a form that
can be decrypted.  If it can be decrypted, then in theory it can be
decrypted by an someone who should not have access.

It's better to store passwords using a one-way digest algorithm, so that
the original string can never be retrieved.  For example, MD5 or
SHA-256.

  $stmt = $db->prepare('INSERT INTO accounts VALUES (account_name,
password) VALUES (?, ?)');
  $stmt->execute(array('rohitsing', mhash(MHASH_SHA256, 'secret')));

Then when you need to validate a user's login input, apply the same
one-way digest algorithm, and compare the result to the hash string
stored in the database.  If the user's input matched the original
password, the two digest strings should be equal.

  $result = $db->fetchAll(
'SELECT ? = a.password AS PASSWORD_MATCH 
 FROM accounts a WHERE a.account_name = ?', 
array(mhash(MHASH_SHA256, $input_password), $input_account)
  );
  if ($result['PASSWORD_MATCH']) { /* yes, the password given is correct
*/ }

However, to answer your question, if you need the password to be
decrypted, you can use a reversible encryption algorithm.  The safest
way to do this is to use symmetric keys.  That is, encrypt a string
using a public key and then only your private key can decrypt it.  Take
care not to let the private key fall into the wrong hands.
See:
http://php.net/openssl-public-encrypt
http://php.net/openssl-private-decrypt

Use base64_encode() to make the string safe for storing in a database
varchar column.
http://php.net/base64-encode

Regards,
Bill Karwin

> -Original Message-
> From: Rohit83 [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 23, 2007 3:40 AM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Encryption and Decryption
> 
> 
> Hi All,
>I want to know how to insert password in database 
> with encrypted form and how to retrieve that in original form.
> 


Re: [fw-general] Single views directory

2007-08-23 Thread Matthew Weier O'Phinney
-- Charles Harley <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 02:47 PM +0100):
> Was looking through the ZF documentation for another problem and found 
> the solution to this problem:
> 
> http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelper.viewrenderer.advancedusage.example-1

I had flagged your message for a reply, and was going to point that out
along with examples, but you evidently found it on your own --
excellent!

> I am constantly impressed by the flexibility you developers have 
> incorporated into the framework, well done!

Flexibility has been a goal from the start -- I'm glad that, at least
for this issue, we reached that goal!

> Charles Harley wrote:
> > Is it possible to have a single directory that templates are saved to, 
> > that also works with modules? The documentation shows that there must 
> > be a views directory under each of the module directories.

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


Re: [fw-general] Single views directory

2007-08-23 Thread Charles Harley
Was looking through the ZF documentation for another problem and found 
the solution to this problem:


http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelper.viewrenderer.advancedusage.example-1

I am constantly impressed by the flexibility you developers have 
incorporated into the framework, well done!


Charles

Charles Harley wrote:

Hi All,

Is it possible to have a single directory that templates are saved to, 
that also works with modules? The documentation shows that there must 
be a views directory under each of the module directories.


Many thanks,

Charles





Re: [fw-general] Root controller and module with same name

2007-08-23 Thread Matthew Weier O'Phinney
-- Charles Harley <[EMAIL PROTECTED]> wrote
(on Thursday, 23 August 2007, 12:39 PM +0100):
> I'm developing a site with default controllers that has the same name as 
> some of the modules. This is done because I need to have links such as 
> the following:
> 
> www.domain.com/clients/index
> www.domain.com/clients/subscribe
> www.domain.com/clients/jobs/index
> 
> I know I can just create an index controller and a subscribe controller 
> as part of the clients module but it would be neater if I was able to 
> create a clients controller as part of the default module that then just 
> has actions for index and subscribe and then create the jobs controller 
> as part of the clients module. Is it possible to configure the framework 
> to work this way?

Use a custom route to map the URLs you want to the appropriate actions
in the module's index controller.

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


[fw-general] Single views directory

2007-08-23 Thread Charles Harley

Hi All,

Is it possible to have a single directory that templates are saved to, 
that also works with modules? The documentation shows that there must be 
a views directory under each of the module directories.


Many thanks,

Charles



[fw-general] Root controller and module with same name

2007-08-23 Thread Charles Harley

Hi All,

I'm developing a site with default controllers that has the same name as 
some of the modules. This is done because I need to have links such as 
the following:


www.domain.com/clients/index
www.domain.com/clients/subscribe
www.domain.com/clients/jobs/index

I know I can just create an index controller and a subscribe controller 
as part of the clients module but it would be neater if I was able to 
create a clients controller as part of the default module that then just 
has actions for index and subscribe and then create the jobs controller 
as part of the clients module. Is it possible to configure the framework 
to work this way?


Many thanks,

Charles




Re: [fw-general] Problem with zfgrid demo app

2007-08-23 Thread Dominik Sandjaja
hano wrote:
> Hi,
> 
> I have some configuration problems (my guess). The code:
> 
> tables): ?>
>   
> doesn't work, however if I change the code to use " 
> tables): ?>
>   
> is working. What could be the problem?

The problem is the use of the short open tag in the examples. See [1].
There has also been a discussion (or was it only part of a discussion?)
on one of the fw-* mailinglists about that lately.

Greetings,
Dominik

[1] 

-- 
Dominik Sandjaja.  Encrypted mails welcome. GPG: 0x1C1DCFF6
Ahornweg 7  |  Mobil:  +49 (0)177 2163314
D-47877 Willich |  ICQ:35 692 530
http://www.dadadom.de   '  Jabber: [EMAIL PROTECTED]


[fw-general] Encryption and Decryption

2007-08-23 Thread Rohit83

Hi All,
   I want to know how to insert password in database with encrypted
form and how to retrieve that in original form.

-- 
View this message in context: 
http://www.nabble.com/Encryption-and-Decryption-tf4316691s16154.html#a12291163
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Problem with zfgrid demo app

2007-08-23 Thread hano

Hi,

I have some configuration problems (my guess). The code:

tables): ?>

doesn't work, however if I change the code to use "tables): ?>

is working. What could be the problem?  

The application is the zfgrid demo application
(http://www.zend.com/webinar#zfwebinar). I'm using Windows XP (SP2) and a
new installation of Apache 2.2 with and PHP 5.2.1. 

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Problem-with-zfgrid-demo-app-tf431s16154.html#a12291107
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Wiki down again

2007-08-23 Thread oetting

:)
-- 
View this message in context: 
http://www.nabble.com/Wiki-down-again-tf4315971s16154.html#a12289053
Sent from the Zend Framework mailing list archive at Nabble.com.