[pLog-general] user authenication by filter

Oscar Renalias oscar at renalias.net
Sun Nov 7 16:51:54 GMT 2004


I am really interested in a patch against the current development trunk  
that will make it work as flawlessly as possible in php5, nothing else.  
I don't think we should use all the features of php5 because not so  
many people have php5 yet but because we don't have that much time  
left. Do you think you could provide a simple patch to *just* make plog  
1.0 work under php5?

Regarding bigger changes to make plog use the new features in php,  
these are definitely further down the road but they are not planned for  
inclusion into 1.0 (we've got more work than we could ever hope for :-)  
But if you're interested in taking care of adapting plog to php5 and  
use things like interfaces (it's about time they added them!),  
abstract, final, etc, we could probably create a php5 branch under svn  
in plog/branches/php5 and give you write access to it. What do you say?

But be warned that it's going to be a tough job... the 1.0 branch  
hasn't stabilized yet, new code is added every day so you'd be pretty  
much chasing a moving target. But if you're up to the task, I don't see  
why not :-)

I'm also interested in starting a new thread about php5.

On 7 Nov 2004, at 16:27, su baochen wrote:

>
> 在2004年11月06日的00:59,Oscar Renalias写道:
>> by the way, do you have a version of plog working well under php5?
>
> Not yet.
>
>>  Did
>> you have to make any changes?
>
> By now, I think some changes,maybe many changes:-)
>
>>  How did you do it?
>
> Main changes to the current plog is:
>
> 1 Will only work under php5, because I use some php5 concepts such as
> abstract, static, final, private... and etc.
>
> 2 Rename class name according to its real class name, borrowed from
> java. Such as, action.class.php -> Action.class. I rename the class  
> name
> because:
> a) Borrowed from Java:-)
> b) I want to use phpunit2, and this is a must change.
>
> 3 Add module support, and move admin class,view and etc to
> modules/admin,sumamry action,view and etc to modules/summary,other
> module can be added too. More generally, I think only plog core classes
> should be putted into class directory, others should be treated as
> modules or plugins.
>
> 4 And, I give up log4php,but using PEAR::Log, because I just can not
> make log4php work under php5:-(, but PEAR::Log works fine.
>
> And, some small changes...
>
> I'd like to open another thread to discuss porting plog to php5, anyone
> interested in it?
>
>> Also, could you send
>> me any patch if needed to make it work? :-)
>
> When plog for php5 can work just as the one for php4, I will release
> here.
>
>>
>> Oscar
>>
>> On 5 Nov 2004, at 02:39, su baochen wrote:
>>
>>> thanks oscar!
>>>
>>> In fact, I first implemented the idea with php5(works on my box), and
>>> back port to php4 of plog last night and not tested it yet:-)
>>>
>>> I will check into the code today, and any hints from anyone would be
>>> ver
>>> y helpful:-)
>>>
>>> 2004年11月05日的02:02,Oscar Renalias写道:
>>>> but... did you even try this code? Did it work for you? Because for
>>>> me,
>>>> it won't work as it is :(
>>>>
>>>> First of all, there were a few errors in the code...
>>>>
>>>> function securityCheck(){
>>>>          $pipeline = new Pipeline( $request, $this->_blogInfo );
>>>> ...
>>>>
>>>> $request doesn't exist in the scope of this function so it should be
>>>> $this->_request
>>>>
>>>> Also later on in the same line:
>>>>
>>>>          $pipeline = new Pipeline( $request, $this->_blogInfo );
>>>>
>>>> it could be that $this->_blogInfo doesn't even exist (try logging  
>>>> out
>>>> completely and then try typing admin?op=newResource for example) and
>>>> see what you get... Try installing first the 'hostblock' plugin,
>>>> you'll
>>>> see that it crashes because it's trying to process a request through
>>>> the pipieline whose BlogInfo object is null. Not good :)
>>>>
>>>> Also. you moved the call to the following method too high in the
>>>> AdminAction constructor:
>>>>
>>>> 	$this->_locale = $this->getLocale();
>>>>
>>>> It cannot be moved so high up because otherwise it won't work...:
>>>>
>>>>          function getLocale()
>>>>          {
>>>>          	// don't like this so much...
>>>>          	if( $this->_blogInfo != "" ) {
>>>>          		$this->_blogSettings = $this->_blogInfo->getSettings();
>>>>              	$locale =& Locales::getLocale(
>>>> $this->_blogSettings->getValue("locale"));
>>>>              }
>>>>              else {
>>>>              	$locale =& Locales::getLocale(
>>>> $this->_config->getValue("default_locale"));
>>>>              }
>>>> 			
>>>> 	return $locale;
>>>>          }
>>>>
>>>> if you call this method *before* you call $this->_getBlogInfo(),  
>>>> then
>>>> the first condition of the if(...) will never be true because we  
>>>> don't
>>>> really have a $blogInfo object loaded yet from the session :( And we
>>>> will always create a Locale object based on the value of the
>>>> default_locale setting instead of the blog's own locale.
>>>>
>>>> So either we fix the pipeline so that all objects check if the
>>>> $blogInfo parameter is null or empty, or we do this in another  
>>>> way...
>>>> (I just don't know in which way :)) I like the idea, it's just that
>>>> the
>>>> implementation is not quite perfect yet (so don't get me wrong!!)
>>>>
>>>> Oscar
>>>>
>>>> On 4 Nov 2004, at 16:49, su baochen wrote:
>>>>
>>>>> hi,
>>>>>
>>>>> Below is the way I have done to authenticate user by filter. But I
>>>>> have
>>>>> not fully tested it,sorry.
>>>>>
>>>>> 1 create loginauthfilter.class.php in class/security directory, see
>>>>> attachment.
>>>>> 2 path class/action/admin/adminaction.class.php, see attachemnt for
>>>>> patch
>>>>> 3 create standarderrorrenderer.class.php in
>>>>> class/template/errorrenderers, see attachment. I create this file
>>>>> inspired by oscar's standardvalidationrenderer.class.php.
>>>>>
>>>>> Again, I have not tested the code under php4, sorry.
>>>>> --    
>>>>> su baochen <subaochen at 126.com>
>>>>> <adminaction.patch><loginauthfilter.class.php><standarderrorrendere 
>>>>> r.
>>>>> cl
>>>>> ass.php>_______________________________________________
>>>>> pLog-general mailing list
>>>>> pLog-general at devel.plogworld.org
>>>>> http://devel.plogworld.org/mailman/listinfo/plog-general
>>>>
>>>> _______________________________________________
>>>> pLog-general mailing list
>>>> pLog-general at devel.plogworld.org
>>>> http://devel.plogworld.org/mailman/listinfo/plog-general
>>> -- 
>>> su baochen <subaochen at 126.com>
>>>
>>>
>>> _______________________________________________
>>> pLog-general mailing list
>>> pLog-general at devel.plogworld.org
>>> http://devel.plogworld.org/mailman/listinfo/plog-general
>>>
>>
>> _______________________________________________
>> pLog-general mailing list
>> pLog-general at devel.plogworld.org
>> http://devel.plogworld.org/mailman/listinfo/plog-general
> -- 
> su baochen <subaochen at 126.com>
>
>
> _______________________________________________
> pLog-general mailing list
> pLog-general at devel.plogworld.org
> http://devel.plogworld.org/mailman/listinfo/plog-general
>




More information about the pLog-general mailing list