[pLog-svn] Rewrite of getSessionValue()
Ammar Ibrahim
ammar.ibrahim at gmail.com
Sat Jul 8 13:50:01 GMT 2006
Why not, I can maintain it once I'm more familiar with the project. It takes
10 seconds to replace this code and commit it
- Ammar
On 7/8/06, Mark Wu <markplace at gmail.com> wrote:
>
> I will suggest we just put it into 1.1 trunk. Unlese we have another sql
> injection bug in 1.0.x series., or I think we won' t have another 1.0.x
> version release.
>
> Mark
>
> > -----Original Message-----
> > From: plog-svn-bounces at devel.lifetype.net
> > [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
> > Sent: Saturday, July 08, 2006 9:07 PM
> > To: plog-svn at devel.lifetype.net
> > Subject: Re: [pLog-svn] Rewrite of getSessionValue()
> >
> > It looks alright, though I don't think it changes
> > anything. A even simpler version is below. We don't have a
> > place to check stuff in for fixes to 1.0.6, do we? This
> > particular fix should not be the one to open a new branch,
> > though if we do end up using one, this might as well get
> > checked in. I can put this in 1.1, definitely.
> >
> > > function getSessionValue( $param, $defaultValue = "" )
> > > {
> > > $session = HttpVars::getSession();
> > > $viewName = $this->className();
> > > $keyName = "{$viewName}_{$param}";
> > >
> > > if ( isset($session[$keyName]) &&
> > $session[$keyName] != '' ){
> > > return $session[$keyName];
> > > } else {
> > > return $defaultValue;
> > > }
> > > }
> >
> >
> >
> > On Sat, 8 Jul 2006, Ammar Ibrahim wrote:
> >
> > > While reading some code, I stumbled across getSessionValue() in
> > > class/view/view.class.php . And I think the logic
> > implemented is quite
> > > complicated to do a really simple thing and there were a
> > few mistakes
> > > like putting a string variable between quotes. Here's a
> > rewrite, could
> > > someone please update the 1.0.6 branch, because I don't
> > have SVN accesss.
> > >
> > > /**
> > > * retrieves a parameter from the session
> > > *
> > > * @param param
> > > * @param defaultValue
> > > * @return The value associated to the parameter or
> > empty if not
> > > * found
> > > */
> > >
> > > function getSessionValue( $param, $defaultValue = "" )
> > > {
> > > $session = HttpVars::getSession();
> > > $viewName = $this->className();
> > > $keyName = "{$viewName}_{$param}";
> > >
> > > $value = '';
> > > if ( isset($session[$keyName]) &&
> > $session[$keyName] != '' ){
> > > $value = $session[$keyName];
> > > } else {
> > > $value = $defaultValue;
> > > }
> > >
> > > return $value;
> > > }
> >
> > --
> > Jon Daley
> > http://jon.limedaley.com/
> >
> > There is forgiveness through the cross.
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http:// devel.lifetype.net/pipermail/plog-svn/attachments/20060708/e75932b9/attachment.html
More information about the pLog-svn
mailing list