[fw-general] Apache .htaccess rewrite help

2012-05-24 Thread Gunter Sammet
Hi all:
I'm trying to modify my rewrite rule to meet a few new conditions.
Currently I have:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

New rules that need to be matched:

Requests to main url (www.domain.com, domain.com, www.domain.com/index.php,
domain.com/index.php) need to be redirected to

domain.com/browse/locations

The following request URLs (with or without www) are OK:
domain.com/browse/locations (plus all URLs below browse/locations.
E.g. 
/browse/locations/detailPage/browse_locations/process_action/search/lp_id/2090)
domain.com/account (plus all URLs below)
domain.com/authentication (plus all URLs below)

Every other request should be redirected to newdomain.com

Any help would be appreciated!
Thanks,

Gunter


Re: [fw-general] Apache .htaccess rewrite help

2012-05-24 Thread Gunter Sammet
Can you please give me a few examples how that would work. I'm a bit time
pressed and I haven't done too much with rewrite.
Thanks,

Gunter


On Thu, May 24, 2012 at 1:01 PM, Oscar Merida os...@oscarm.org wrote:

 you need to use RewriteCond to detect the domains and paths for
 applying some rules only to matches.


 On Thu, May 24, 2012 at 1:53 PM, Gunter Sammet gunter.sam...@gmail.com
 wrote:
  Hi all:
  I'm trying to modify my rewrite rule to meet a few new conditions.
  Currently I have:
 
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
 
  New rules that need to be matched:
 
  Requests to main url (www.domain.com, domain.com,
 www.domain.com/index.php,
  domain.com/index.php) need to be redirected to
 
  domain.com/browse/locations
 
  The following request URLs (with or without www) are OK:
 domain.com/browse/locations (plus all URLs below browse/locations.
  E.g.
 /browse/locations/detailPage/browse_locations/process_action/search/lp_id/2090)
 domain.com/account (plus all URLs below)
 domain.com/authentication (plus all URLs below)
 
  Every other request should be redirected to newdomain.com
 
  Any help would be appreciated!
  Thanks,
 
  Gunter



 --
 Oscar Merida
 * http://OscarM.org - random thoughts on my blog
 * http://SoccerBlogs.net - your daily soccer feed
 * http://FutBoliviano.com - bolivian soccer, futbol de altura



[fw-general] 2D Barcode generation (e.g. DataMatrix ECC200)

2009-10-01 Thread Gunter Sammet
Hi all:
I'm in the need of generating 2D barcode (DataMatrix ECC200 for shipping
labels). So far I haven't found anything open source that would allow me to
create them. So I thought it might be a good addition to ZF. Checked if
there is already any barcode project in ZF and I found the following:

http://framework.zend.com/wiki/pages/viewpage.action?pageId=43220
svn://mikaelkael.dyndns.org/barcode

Haven't checked out the code yet. Will do so ASAP.

Not sure how much work it would be, to get 2D barcodes integrated. Any
thoughts and pointers would be appreciated.

Thanks,

Gunter

PS: So far I have only found commercial software for 2D barcodes. This would
be my current pick if I have to buy something:
http://www.aditus.nu/jpgraph/proversion.php (Professional version of
jpgraph).


[fw-general] too quiet today. testing

2008-10-13 Thread Gunter Sammet
Hi all:
Haven't received a single email today. That's unusual.

Gunter


Re: [fw-general] Error500 with Apache

2008-04-26 Thread Gunter Sammet
Are you working with sessions? If yes, it might be because of session
conflicts. Try to set a different session directory for each domain.
HTH

Gunter

On Sat, Apr 26, 2008 at 5:44 PM, cjant83 [EMAIL PROTECTED] wrote:


 I've spent another 8 hours or so on this now. I've gone through all the
 code,
 I made a couple of adjustments but nothing major, and I'm still in the
 same
 boat. However!! I think I may have found the fault

 I've been trying to re-create the error on my site by following links, and
 refreshing for the past half an hour and its been working fine until I
 logged into Horde webmail which is on a different domain but same server,
 and after logging in when I refreshed my web site I had the same error as
 earlier.

 I've tried this a few times, I definately think Horde is the problem. I
 got
 no idea what its doing but its breaking something!! Im guessing this is
 why
 its been breaking before. Its gone midnight now and no one is logged in on
 my server but during the day there will be a few of my customers using
 webmail so that is why it seemed random.

 Now I have found the problem I dont know how to fix it :). Any
 suggestions?
 I suspect Horde is re-writing something to do with the include_path in
 PHP.
 I know this is going off topic and not fully ZF question but I'm sure
 someone else will have come accross this problem before and know the
 solution.

 Thank you,
 Chris.







 tfk wrote:
 
  On Sat, Apr 26, 2008 at 1:09 PM, cjant83 [EMAIL PROTECTED] wrote:
 
   Hey,
   Ive written an application using ZF1.5 on my Windows machine with WAMP
   server installed. It works brilliantly, but when I uploaded it to my
 web
   server (Linux,PHP5.2,MySQL5) I get into problems. The site works most
 of
  the
   time, but randomly it throws up an Error 500. I've turned
 display_errors
  ON
   to see if that would help, and it kind of does. It gives me the
  following
   error message:
 
   Warning: require_once(Zend/Loader.php) [function.require-once]: failed
  to
   open stream: No such file or directory in
   /var/www/**/httpdocs/app/bootstrap.php on line 36
   Fatal error: require_once() [function.require]: Failed opening
 required
   'Zend/Loader.php' (include_path='.:') in
   /var/www/**//httpdocs/app/bootstrap.php on line 36
 
   But it works at other times so how can it not be finding the Loader?
   :confused:
 
 
   Here is the top part of my bootstrap up to the point its complaining.
 
   define('DS', DIRECTORY_SEPARATOR);
   define('PS', PATH_SEPARATOR);
   define('ROOT_DIR', dirname(dirname(__FILE__)));
 
   /*
* Set include path
*/
   $incpath[] = ROOT_DIR . DS . 'app' . DS . 'code' . DS . 'config';
   $incpath[] = ROOT_DIR . DS . 'app' . DS . 'code' . DS . 'models';
   $incpath[] = ROOT_DIR . DS . 'app' . DS . 'library';
   $incpath[] = ROOT_DIR . DS . 'skins';
   $inc_path = implode(PS, $incpath);
   set_include_path($inc_path . PS . get_include_path());
 
   /*
* Initialise the Zend_Loader and AutoLoad
*/
   require_once 'Zend' . DS . 'Loader.php';
   Zend_Loader::registerAutoLoad();
 
 
   Anyone have a clue??
 
  Is that php(5)-cgi? Or mod_php? With lots of traffic, I had random
  errors like that with php-cgi (5.2.5), but I was unable to debug that
  in production. ;-)
 
  Btw, if you put display_errors = Off, make sure to enable log_errors =
  On (also look into the file setting for syslog or a custom logfile).
  :-)
 
  Till
 
 

 --
 View this message in context:
 http://www.nabble.com/Error500-with-Apache-tp16911831p16918115.html
  Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Error500 with Apache

2008-04-26 Thread Gunter Sammet
Could it be that Horde changes the include path for some reason. If it's set
in php.ini or even .htaccess it shouldn't happen but just another thought.

On Sat, Apr 26, 2008 at 5:09 AM, cjant83 [EMAIL PROTECTED] wrote:


 Hey,
 Ive written an application using ZF1.5 on my Windows machine with WAMP
 server installed. It works brilliantly, but when I uploaded it to my web
 server (Linux,PHP5.2,MySQL5) I get into problems. The site works most of
 the
 time, but randomly it throws up an Error 500. I've turned display_errors
 ON
 to see if that would help, and it kind of does. It gives me the following
 error message:

 Warning: require_once(Zend/Loader.php) [function.require-once]: failed to
 open stream: No such file or directory in
 /var/www/**/httpdocs/app/bootstrap.php on line 36
 Fatal error: require_once() [function.require]: Failed opening required
 'Zend/Loader.php' (include_path='.:') in
 /var/www/**//httpdocs/app/bootstrap.php on line 36

 But it works at other times so how can it not be finding the Loader?
 :confused:


 Here is the top part of my bootstrap up to the point its complaining.

 define('DS', DIRECTORY_SEPARATOR);
 define('PS', PATH_SEPARATOR);
 define('ROOT_DIR', dirname(dirname(__FILE__)));

 /*
  * Set include path
  */
 $incpath[] = ROOT_DIR . DS . 'app' . DS . 'code' . DS . 'config';
 $incpath[] = ROOT_DIR . DS . 'app' . DS . 'code' . DS . 'models';
 $incpath[] = ROOT_DIR . DS . 'app' . DS . 'library';
 $incpath[] = ROOT_DIR . DS . 'skins';
 $inc_path = implode(PS, $incpath);
 set_include_path($inc_path . PS . get_include_path());

 /*
  * Initialise the Zend_Loader and AutoLoad
  */
 require_once 'Zend' . DS . 'Loader.php';
 Zend_Loader::registerAutoLoad();


 Anyone have a clue??
 --
 View this message in context:
 http://www.nabble.com/Error500-with-Apache-tp16911831p16911831.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] instantiate an object with a variable name for the class

2008-04-24 Thread Gunter Sammet
Did you try eval?

$table1 = eval(new $originTable(););

Might has some overhead though!
Cheers,

Gunter



On Thu, Apr 24, 2008 at 8:56 AM, Denis Fohl [EMAIL PROTECTED] wrote:

 Hi all,

 sorry i forgot the subject in my previous post :

 i'm trying to implement a class to manage manytomany relationships in
 backoffice, i'd like to standardize it for reusability.
 I would like to pass to the constructor of my class the name of the tables
 involved (destination table, origin table, intersection table) and that it
 instantiate correspondings Zend_Db_Table objects.

 So now is the question : how can i instantiate an object (Zend_Db_Table
 here) with a variable classname :

 function __construct ($originTable, $destinationTable) {

$table1 = new $originTable();
...

 }

 i can't find what i want on google (tried call_user_func but that's not
 it).

 Thanks.

 Denis.




Re: [fw-general] CALC_FOUND_ROWS vs. count(*)

2008-04-17 Thread Gunter Sammet
I ended up retrieving the SQL as string and do a string replace and then
execute the SQL statement. Not very elegant but it solved my problem at that
time. If you come up with a more elegant way, please let me know.
Once I have time I'd like to add this as a functionality to the select class
to allow for an DB independant way of doing this. I remember that I asked in
the forum before and at that time it didn't seem to be very much required
and for that reason didn't have much importance.
HTH

Gunter

On Thu, Apr 17, 2008 at 2:07 PM, Mark Steudel [EMAIL PROTECTED] wrote:

  Well couple of problems,



1. I can't mix a count() statement in my sql statement the whole
mixing group columns with non group columns thing
2. Even if I try and trick it by putting at the begging the select
methods quote everything, so it because something like:

SELECT `SQL_CALC_FOUND_ROWS table`.`id` ….



 :/ Any other ideas?



 MS


  --

 *From:* James Dempster [mailto:[EMAIL PROTECTED]
 *Sent:* Thursday, April 17, 2008 12:48 PM
 *To:* Mark Steudel
 *Cc:* fw-general@lists.zend.com
 *Subject:* Re: [fw-general] CALC_FOUND_ROWS vs. count(*)



 Have you tried

 array('line_items_per_product' = 'CALC_FOUND_ROWS COUNT(*)'))

 I think that might work.

 --
 /James

 On Thu, Apr 17, 2008 at 8:06 PM, Mark Steudel [EMAIL PROTECTED] wrote:

 Hey Guys,



 I was looking for a way to use CALC_FOUND_ROWS in mysql, I saw in the
 documentation you could get the same thing by doing this:



 array('line_items_per_product' = 'COUNT(*)'))



 If I wanted to do CALC_FOUND_ROWS instead, how would I do it utilizing the
 Zend_DB?



 Thanks, Mark







Re: [fw-general] CALC_FOUND_ROWS vs. count(*)

2008-04-17 Thread Gunter Sammet
Hi Simon:
The reason to prepend CALC_FOUND_ROWS in MySQL is to be able to get the
total number of rows for a statement if you restrict with a limit for
pagination. Have a quick look at
http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_found-rows
to
see how it works.
For pagination it would be nice having a way to determine the number of rows
without the limit clause. Since Zend_Db handles multiple databases we would
need an implementation for each flavor.
As mentioned before, I suggested it before but didn't get much feedback on
it. And I didn't have the time to work on it myself.
Cheers,

Gunter




On Thu, Apr 17, 2008 at 9:01 PM, Simon Mundy [EMAIL PROTECTED]
wrote:

 Hi Mark

 Do I understand correctly that you just needed to use that function as a
 returning field?

 If so, did the following not work for you?

 $select-from('yourtable', array('line_items_per_product' = new
 Zend_Db_Expr('CALC_FOUND_ROWS')));

 Using a Zend_Db_Expr prevents a string from having further escaping
 applied to it.

 Cheers


 Well ... I played around with this and was able to hack up the Select
  class
  to put this functionality in. here it is if anyone is interested:
 
  http://www.mindfulinteractive.com/zend/Select.txt
 
  Basically you can now do something like
 
  $select-sqlCalcFoundRows();
 
  And it will add 'SQL_CALC_FOUND_ROWS' at the beginning of the sql
  statement.
  I don't know what will happen if you do both distinct and
  sqlCalcFoundRows
  ...
 
  I'm now trying to see if I can subclass it, but I'm not a OOP Master.
  Here's
  my attempt, but I can't quite seem to override $_partsInit with my
  $_partsInit ...
 
  ?php
 
  class NewSelect extends Zend_Db_Select {
 const CALC_ROWS  = 'sqlCalcFoundRows';
 const SQL_CALC_ROWS  = 'SQL_CALC_FOUND_ROWS';
 
 /**
 * The initial values for the $_parts array.
 * NOTE: It is important for the 'FOR_UPDATE' part to be last to
  ensure
 * meximum compatibility with database adapters.
 *
 * @var array
 */
protected static $_partsInit = array(
self::DISTINCT = false,
self::CALC_ROWS= false,
self::COLUMNS  = array(),
self::FROM = array(),
self::WHERE= array(),
self::GROUP= array(),
self::HAVING   = array(),
self::ORDER= array(),
self::LIMIT_COUNT  = null,
self::LIMIT_OFFSET = null,
self::FOR_UPDATE   = false
);
 
 public function sqlCalcFoundRows( $flag = true )
{
 echo 'test';
 $this-_parts[self::CALC_ROWS] = (bool) $flag;
 return $this;
}
 
 protected function _renderSqlCalcFoundRows( $sql )
{
 if( $this-_parts[self::CALC_ROWS]) {
 $sql .= ' ' . self::SQL_CALC_ROWS ;
 }
 
 return $sql;
}
  }
 
  MS
  -Original Message-
  From: Shekar C Reddy [mailto:[EMAIL PROTECTED]
  Sent: Thursday, April 17, 2008 1:41 PM
  To: Gunter Sammet
  Cc: Mark Steudel; James Dempster; fw-general@lists.zend.com
  Subject: Re: [fw-general] CALC_FOUND_ROWS vs. count(*)
 
  Creating a Jira issue would be ideal to keep a track of this task.
 
 
 
  On Thu, Apr 17, 2008 at 3:21 PM, Gunter Sammet [EMAIL PROTECTED]
  wrote:
 
   I ended up retrieving the SQL as string and do a string replace and
   then
   execute the SQL statement. Not very elegant but it solved my problem
   at
  
  that
 
   time. If you come up with a more elegant way, please let me know.
   Once I have time I'd like to add this as a functionality to the select
  
  class
 
   to allow for an DB independant way of doing this. I remember that I
   asked
  
  in
 
   the forum before and at that time it didn't seem to be very much
   required
   and for that reason didn't have much importance.
   HTH
  
   Gunter
  
  
  
   On Thu, Apr 17, 2008 at 2:07 PM, Mark Steudel [EMAIL PROTECTED]
   wrote:
  
  
   
   
   
Well couple of problems,
   
   
   
I can't mix a count() statement in my sql statement the whole mixing
   
   group
 
   columns with non group columns thing
  
Even if I try and trick it by putting at the begging the select
methods
   
   quote everything, so it because something like:
  
   
SELECT `SQL_CALC_FOUND_ROWS table`.`id` ..
   
   
   
:/ Any other ideas?
   
   
   
MS
   
   
   

   
  
  
From: James Dempster [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 17, 2008 12:48 PM
To: Mark Steudel
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] CALC_FOUND_ROWS vs. count(*)
   
   
   
   
   
   
Have you tried
   
array('line_items_per_product' = 'CALC_FOUND_ROWS COUNT(*)'))
   
I think that might work.
   
--
/James
   
   
On Thu, Apr 17, 2008 at 8:06 PM, Mark Steudel [EMAIL PROTECTED]
   
   wrote:
 
  
   
   
Hey Guys,
   
   
   
I was looking for a way to use

[fw-general] FormSelect view helper

2008-01-14 Thread Gunter Sammet
Hi all:
Not sure if it is because of the way I use the FormSelect view helper
or if I am missing!?

Tried the following code:

$this-_view-formSelect($name, $value,
(is_array($fieldValue['attributes'])?$fieldValue['attributes']:array()),
array('1' = 'Yes', '0' = 'No'))

$value is a tinyint (MySQL). This code checked all drop downs with yes
even if $value was 0.

Changing the code to

$this-_view-formSelect($name, intval( $value ),
(is_array($fieldValue['attributes'])?$fieldValue['attributes']:array()),
array(1 = 'Yes', 0 = 'No'))

works.

According to the view helper source:

// selected?
if (in_array($value, $selected, 0 === $value)) { //this is the
options value, not the field value. So it's the key of the array!!!
$opt .= ' selected=selected';
}

if the options value === int 0, in array checks the datatype. In my
initial code it should be string 0 ('0' = 'No'), so it shouldn't
check the datatype. However, the code for some reason didn't work. If
I use int 0 and convert the field value to int 0 with intval, it
works.

Anybody out there that has an idea why this is the case? For now the
second solution works for me, so most likely won't dig any deeper.

TIA

Gunter


[fw-general] little bug in url view helper

2008-01-09 Thread Gunter Sammet
Hi all:
Been banging my head with this one. Some of my code broke after the
last update to then current CVS. Ended up being changes to the url
view helper. If you pass in parameters as null, they should be removed
by the assemble method (undocumented feature but I assume it's
intended). however, recent changes to urlencode the urlOptions broke
this behaviour. the php function urlencode returns an empty string. So
the route-assemble method doesn't know anymore that it was null. I
suggest the following fix:

if ($encode) {
foreach ($urlOptions as $key = $option) {
if(null === $option){
$urlOptions[$key] = $option;
}else{
$urlOptions[$key] = urlencode($option);
}
}
}

Unless there is an issue with unencoded null values (which I can't
picture), this should solve the issue without causing any
compatibility issues.

Anybody out there that can commit this fix?
Thanks,

Gunter


[fw-general] URL view helper question

2008-01-08 Thread Gunter Sammet
Hi all:
When I use the url view helper the following way:

$view-ajaxBaseUrl = $view-url(array('action' = 'ajax-functions',
'page' = null, 'aAction' = null, 'process_action' = null,
'detailPage' = null));

I've been under the assumption that it will remove nulled parameters.
IIRC it has been working before. So not sure if it broke after the
last update. Haven't checked the changes to the view helper yet. Just
been wondering if somebody else noted this. The Url the above
producses is:

/baseurl/browse/ajax-functions/detailPage//process_action//lp_id/1940/page//aAction//

Any pointers would be appreciated!
Thanks,

Gunter


[fw-general] View for html email

2007-11-28 Thread Gunter Sammet
Hi all:
Just been wondering if there is a way to render a view for an html
email that is not used in the display. I'm currently using Smarty as
template engine integrated in the view. Now I would like to send out
html emails using templates but rendering them with the data the same
way I would do for displaying in the browser.
Any thoughts?
Thanks,

Gunter


Re: [fw-general] View for html email

2007-11-28 Thread Gunter Sammet
Thanks Julian and Peter!

I know that I could do it the Smarty only way but I want to avoid it
if possible to allow changing it down the road in case I decide to use
another template engine or the Zend phtml templating.
Will have to try Peters suggestion. However, I need to render a view
for the Email successfully sent view. Thought I might be able to use
some of the named segments for that. Other option I have been thinking
is, to turn off the view renderer, render the email view and then turn
it on again. I believe that should work as well. Will have to play a
bit with it. Just thought somebody might has done something similar
before.

Gunter


Re: [fw-general] Using Joins and Zend_DB_Table

2007-11-15 Thread Gunter Sammet
Marco:
Simon posted me the following yesterday on another thread:

snip
Hi Gunter


The new Zend_Db_Table proposal has been committed to the incubator -
you can download that and give it a try. It allows a query like so:-


$myModel = new Customer();
$rows = $myModel-fetchAll($myModel-select()-join(array('ci' =
'cities'), 'ci.city_id = customers.city_id', array())-order('ci.name
DESC'));


You can reference the JOINed tables any way you like as long as they
don't form part of the returned columns (that will throw an error).
Otherwise you can sort on them, reference them in WHERE clauses, etc.


Bear in mind the new component hasn't any unit tests yet, but they are
performing well so far in the apps I've deployed them in.


Kind regards
/snip

Might work for you as well!
HTH

Gunter

On Nov 15, 2007 1:13 AM, Marco [EMAIL PROTECTED] wrote:

 On 14/11/2007, Gunter Sammet [EMAIL PROTECTED] wrote:



  IIRC you can't do this with Zend_DB at the moment. You will have to
  create your SQL manually using Zend_DB_Select:
  e.g.
  code
  $select = $db0-select()
-from( array('p' = 'photos'),
  array('p.photo_id', 'p.photo_name', 'p.photo_tn', 'p.photo_image',
  'p.location_link', 'p.keyword_id_primary', 'p.keyword_id_secondary',
  'p.photo_desc', ' p.photo_month', 'p.photo_year') )
-join(array('m' = 'municipalities'), 'p.mun_id
  = m.mun_id', array('m.mun_name'));
 
  $select-where(
  $db0-quoteIdentifier('m.population') . '  ?', (int)$munSize[0] )
 -where(
  $db0-quoteIdentifier('m.population') . '  ?', (int)$munSize[1] );
 
  $select-where(
  $db0-quoteIdentifier('lpp.location_package_id') . ' = ?',
  $this-_locationPackageId )
 -join(array('lpp' =
  'location_package_photos'), 'lpp.photo_id = p.photo_id')
 -order( array('sort_order', 'package_new') );
 
  See http://framework.zend.com/manual/en/zend.db.select.html
  HTH
 
  Gunter
  /code

 Thanks Gunter, I will use this approach instead.

 Regards

 Marco



[fw-general] Zend Upload

2007-11-11 Thread Gunter Sammet
Hi all:
Does anybody already have written an upload class for Zend Framework?
If yes, would it be possible to share the code.
Thanks,

Gunter


Re: [fw-general] Zend Upload

2007-11-11 Thread Gunter Sammet
Thanks Thomas. I saw the proposal. Just been wondering if somebody had
some code already.

G.


On Nov 11, 2007 10:21 AM, Thomas Weidner [EMAIL PROTECTED] wrote:
 See
 http://framework.zend.com/wiki/display/ZFPROP/Zend_Http_Upload+-+Thomas+Weidner

 But the proposal is actually in the review process so there is no finished
 code avaiable for now.

 Greetings
 Thomas


 - Original Message -
 From: Gunter Sammet [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Sunday, November 11, 2007 4:58 PM
 Subject: [fw-general] Zend Upload


  Hi all:
  Does anybody already have written an upload class for Zend Framework?
  If yes, would it be possible to share the code.
  Thanks,
 
  Gunter




[fw-general] Validation issue

2007-11-05 Thread Gunter Sammet
Hi all:
I'm banging my head with the following validation:

'filters' = array(

'StringTrim',
  ),
'validators' = array(

array('Regex', $regexAlnumPlus),

'allowEmpty' = false,

'presence' = 'required',

'messages' = array(

'regexNotMatch' = 'First name contains illegal characters. Only ' .
$regexAlnumPlusMessage . ' are allowed!',

),

The regex is:

list($regexAlnumPlus, $regexAlnumPlusMessage) =
array(/^[a-zA-Z0-9 .,'\-_]*$/, 'a-z, A-Z, 0-9, -, _, ., comma, space and
single quotes');

The issue is that it allows empty fields. I could use the following regex:

 $regexPatternAndMessage = array(/^[a-zA-Z0-9 .,'\-_]+?$/,
'a-z, A-Z, 0-9, -, _, ., comma, space and single quotes');

I'd prefer to get a Field can not be empty message instead of the pattern
match message.

Checked the code and it seems like Zend_Filter_Input only checks for empty
if there hasn't been a validation (line 642:
$validatorRule[self::VALIDATOR_CHAIN_COUNT] = $i; and then 736 till 743:

if ($validatorRule[self::ALLOW_EMPTY] == true) {
continue;
}
if ($validatorRule[self::VALIDATOR_CHAIN_COUNT] ==
0) {
$notEmptyValidator =
$this-_getValidator('NotEmpty');

$notEmptyValidator-setMessage($this-_getNotEmptyMessage($validatorRule[self::RULE],
$fieldKey));

$validatorRule[self::VALIDATOR_CHAIN]-addValidator($notEmptyValidator);
}

Any insight would be greatly appreciated!
TIA

Gunter


[fw-general] init on extended objects

2007-11-05 Thread Gunter Sammet
Having some issues with inheritance and calling the init function. My
controller classes inhert from:

AdminController extends SaSo_Controller_Action

and

SaSo_Controller_Action extends Zend_Controller_Action

I added the constructor in both classes (AdminController and
SaSo_Controller_Action):

public function __construct(Zend_Controller_Request_Abstract $request,
Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
$this-init();
}

I assumed that init() in each class gets called. However, this haven't been
the case. So I tried to call the parent init function:

AdminController:
public function init()
{
parent::init();
$this-view = SaSo_Registry::get( 'view' );
$view-leftNavigation = 'admin';
$view-leftNavigationCap = ucfirst($view-leftNavigation);
$view-bodyContentImage = 'hed_admin.gif';
}

SaSo_Controller_Action:
public function init()
{
parent::init();
}

Here 2 questions:
   -It doesn't seem that the view variables have been assigned. What could
be the reason?
   -Would the init function be called twice if it's called in each
constructor and also in each init function?

Any insight would be appreciated!
TIA

Gunter


Re: [fw-general] custom route problem

2007-10-17 Thread Gunter Sammet
Hi all:
I have following custom route:

$router = $frontController-getRouter();
$browseRoute = new Zend_Controller_Router_Route(
   '/:action/:detailPage/*', // URL to match; action and id will
be matched
   array(
   'module' = 'default', // 'default' module
   'controller' = 'browse',
   'detailPage' = 'index'
   )
);
$router-addRoute('browse', $browseRoute);


All requests that have an existing controller (e.g. base url/admin or
base url/admin/index or base url/admin/index or base
url/admin/list/view/test etc.) should use the default route.

Any suggestions on how to solve this problem?
TIA

Gunter


Re: [fw-general] custom route problem

2007-09-03 Thread Gunter Sammet
I figured that portion of the problem out.

Still need to resolve the default router issue. base url/admin needs to
route through the default router.

Thanks,

Gunter


On 9/2/07, Leo Büttiker [EMAIL PROTECTED] wrote:

 Hi Gunter
 You have to write a asterix '*' for the parameters. Something like
 '/:action/:detailPage/*'.
 Cheers,
 Leo

 
 Von: Gunter Sammet [mailto:[EMAIL PROTECTED]
 Gesendet: Samstag, 1. September 2007 03:55
 An: fw-general@lists.zend.com
 Betreff: [fw-general] custom route problem

 Hi all:
 I have following custom route:

 $router = $frontController-getRouter();
 $browseRoute = new Zend_Controller_Router_Route(
 '/:action/:detailPage', // URL to match; action and id will
 be matched
 array(
 'module' = 'default', // 'default' module
 'controller' = 'browse',
 'detailPage' = 'index'
 )
 );
 $router-addRoute('browse', $browseRoute);


 I want to use this custom route only for my browse controller matching
 (locations|expertise|advantage|info|lifestyle) actions. It works partially
 for e.g. base url/locations or base url/locations/browse_locations but
 it doesn't work for base url/locations/browse_locations/page/2 (should
 also work for base
 url/locations/browse_locations/page/2/key1/value1/.../.../keyX/valueX).

 All requests that have an existing controller (e.g. base url/admin or
 base url/admin/index or base url/admin/index or base
 url/admin/list/view/test etc.) should use the default route.

 Any suggestions on how to solve this problem?
 TIA

 Gunter




[fw-general] custom route problem

2007-08-31 Thread Gunter Sammet
Hi all:
I have following custom route:

$router = $frontController-getRouter();
$browseRoute = new Zend_Controller_Router_Route(
   '/:action/:detailPage', // URL to match; action and id will
be matched
   array(
   'module' = 'default', // 'default' module
   'controller' = 'browse',
   'detailPage' = 'index'
   )
);
$router-addRoute('browse', $browseRoute);


I want to use this custom route only for my browse controller matching
(locations|expertise|advantage|info|lifestyle) actions. It works partially
for e.g. base url/locations or base url/locations/browse_locations but
it doesn't work for base url/locations/browse_locations/page/2 (should
also work for base
url/locations/browse_locations/page/2/key1/value1/.../.../keyX/valueX).

All requests that have an existing controller (e.g. base url/admin or
base url/admin/index or base url/admin/index or base
url/admin/list/view/test etc.) should use the default route.

Any suggestions on how to solve this problem?
TIA

Gunter


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.




[fw-general] Zend_Json issue

2007-08-12 Thread Gunter Sammet
Hi all:
We noticed yesterday on the IRC chat (zftalk) that there is an issue with
Zend_Json::encode:

$test = array(test à test);
$test2 = Zend_Json::encode($test);
print_r($test);
print('brEncoded array: ' . $test2);

$test2 contains only 'test '. This was done on PHP 5.2.1. Checking the
source code revealed that the encode function uses json_encode if existent.
Looking in the php docs (
http://ca3.php.net/manual/en/function.json-encode.php) I found the following
comment:

snip
Take care that json_encode() expects strings to be encoded to be in UTF8
format, while by default PHP strings are ISO-8859-1 encoded.
This means that

json_encode(array('àü'));

will produce a json representation of an empty string, while

json_encode(array(utf8_encode('àü')));

will work.
The same applies to decoding, too, of course...
/snip


Using the following code worked for Zend_Json::encode:

$test = array(test à test);
Zend_Json::$useBuiltinEncoderDecoder = true;
$test2 = Zend_Json::encode($test);
print_r($test);
print('brEncoded array: ' . $test2);


Not 100% certain if there should be an auto detection for the encoding or if
it should be the developers responsibility to pass in utf8 strings into the
encode function. According to the guy who had the issue, it worked on one
PHP version with json_encode but not on another.

Any thoughts?

Gunter


[fw-general] Zend Auth Adapter DbTable

2007-06-19 Thread Gunter Sammet

As I am weeding my way through Zend Sessions and Authentication, I noticed a
possible typo in the Zend_Auth_Adapter_DbTable manual (
http://framework.zend.com/manual/en/zend.auth.adapter.dbtable.html):

[code]

?php
// Print the identity
echo $result-getIdentity() . \n\n;

// Print the result row
print_r($identity);

[/code]

should most likely read:

[code]

?php
//get the identity row object for the current authentication
$identity = $authAdapter-getResultRowObject();

// Print the identity
echo $result-getIdentity() . \n\n;

// Print the result row
print_r($identity);

[/code]

Looks like there has been missing a line of code.


The other day there has been a post regarding adding comments on the manual
(similar to php.net). Had a look but didn't seem to see any links that allow
for commenting on the manual. Maybe I missed something. If yes, please point
it out to me. If no, it might be a nice feature for down the road to add
some code snippets or comments.

I am also looking forward to a demo app that uses all possible options in
the Zend Framework. So far it's pretty time consuming to piece it together.

Cheers,

Gunter


Re: [fw-general] Really complications Zend_Controller is purpose ZF?

2007-05-29 Thread Gunter Sammet

Matthew, thank you for your hard work and prompt responses. Here a few lines
on my experience so far:

I am pretty new to ZF and MVC. On top of that I want to implement Smarty as
the template engine. Been spending a few days on reading the documentation,
what I could find on the Internet and playing around with the zfdemo code.
Still don't get the whole picture but it makes more and more sense. Figure
it will take me another few days of playing around to understand it a bit
more.
Managed to get some views working through piecing together code pieces from
several tutorials and the zfdemo app. I followed the emails in the last few
weeks, so I knew that there were some changes that are not compatible.
That's why I upgraded today to 1.0.
This broke my setup with the Smarty view, injecting templates out of a
template directory. Since I am still not very proficient in debugging the ZF
and I had $frontController-throwExceptions(true) set, I didn't get the
error message that it didn't find 'index/index.phtml'. It took me a few
hours to figure it out and I am thinking about my potential new structure.
Besides the above, I had to change my smarty view to use extends
Zend_View_Abstract instead of implements Zend_View_Interface which
required me to declare the _run method.
For now till I have my new template structure, I managed to bypass the auto
view settings by using the following lines of code;
   $viewRenderer = new
Zend_Controller_Action_Helper_ViewRenderer($view);
$viewRenderer-setViewBasePathSpec($tmplPath)
-setViewScriptPathSpec('landing.tpl')
-setViewScriptPathNoControllerSpec('landing.tpl')
-setViewSuffix('tpl');
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
//Zend_View_Controller_HelperBroker::addHelper($viewRenderer);
NOTE:
=
--The sample code at
http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.viewrenderer(paragraph
7.9) wants you to implement
Zend_View_Controller_HelperBroker::addHelper($viewRenderer);. However, I
didn't find a HelperBroker there. Seems to be the
Zend_Controller_Action_HelperBroker that is meant there.

Your changes make sense and should make the default setup easier. I will try
to implement it as close as possible to be open for future refactoring.
That's why I didn't use the

$front-setParam('noErrorHandler', true);

If I understand it correctly, that should have solved my problem without
changes. A good read for it is the migration page (
http://framework.zend.com/manual/en/zend.controller.migration.html#zend.controller.migration.fromzeroninethree
)

Hope these lines help some other users to figure it out a bit earlier and
for you to understand the issues ZF newbies may face.

Gunter


[fw-general] Zend table question

2007-05-16 Thread Gunter Sammet

Hi all:
Experimenting with the table class and relationships at the moment. Just
been wondering what would be best for the following situation:

  -Table Photos has 2 columns I want to search on (primary keyword id and
secondary keyword id)
  -Table Keywords contains all keywords having a unique id
  -Table Keyword_variants contains keyword variants pointing to the primary
keyword row.

Now let's say I want to search for primary keyword Church and secondary
keyword Sanctuary and I want to find all photos that have these 2 keywords
assigned. How could that work using the table 2 objects primaryKeyword and
secondaryKeyword. It doesn't appear to me that I can use the
findDependentRowset function since I would have 2 objects.

If it doesn't find the keyword in the primary keyword table, it has to check
the keyword variant table to see if they are there. If it finds them in the
variants table, it needs to look up the primary keyword id (which is in the
variants table) and then look for the Photos. E.g. Churches in the keyword
variant table would point to the Church keyword. Same for Sanctuaries
pointing to Sanctuary.

I know how to construct SQL statements to pull it directly from the Photo
table. Just been wondering if there would be a good object oriented
approach.
TIA

Gunter