[pLog-svn] Rewrite of getSessionValue()

Ammar Ibrahim ammar.ibrahim at gmail.com
Sat Jul 8 12:52:25 GMT 2006


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;
        }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http:// devel.lifetype.net/pipermail/plog-svn/attachments/20060708/ea9c0fbf/attachment.html


More information about the pLog-svn mailing list