[ewiki] Re: ewiki_eventually_initialize()

Hi Andy,

I don't see how your switch() could enhance the "! _F_TEXT" check inside of
ewiki_page(). And it is certainly __too much__ code for this simple task.
But also the switch() won't work either, because the flags are bit-values
which may occour all at the same time (otherwise it was just a {meta}[class]
setting).

And after all, the only difference to the original 3-liner seems to be
the ewiki_auth() call - again: two are too much here, because I still
consider the _PROTECTED_MODE to be highly optional and it should not 
disturb an ordinary Wiki setup.

-  ewiki_auth($id, $data, $action, $_ring=0, $_login=1)
-  ewiki_auth($id, $data, $action,    false, $_login=1)  for _BINARY?

You initially told me to use that ["binary_action"] hook for specialized
plugins - and I think it would therefore be easy to move your relaxed
ewiki_auth() call into one of these instead. Ordinary page plugins are not
to be registered here, you'll need a wrapper for this.

Finally, I rethought about the _TEXT and _BINARY thingi, and came to the
conclusion, that it could be (for some extensions) desireable to let
{flags}==_TEXT|_BINARY pages pass (but that being the only exception).
- But this gets first a concern, when the first serialized()-{content}
plugin arrives.

mario



> I only got a few minute; to work on this today so I re-wrote the flags
> check, could you tell me if this code correctly handles EWIKI_DB_F_DISABLED
> and EWIKI_DB_F_SYSTEM?  When I have longer to work on it I'll look somewhat
> closer at what is really going on here, perhaps consolidate all the
> ewiki_auth calls in ewiki_page.
>
>     #-- stop here if disabled page
>     if (   !empty($data["flags"])) {
>         switch($data["flags"] & EWIKI_DB_F_TYPE){
>             case EWIKI_DB_F_DISABLED:
>             case EWIKI_DB_F_SYSTEM:
>                 if(!EWIKI_PROTECTED_MODE || !ewiki_auth($id, $data, $action,
> 0, 1) ){
>                     return(ewiki_t("DISABLEDPAGE")); 
>                 }
>                 break;
>             case EWIKI_DB_F_BINARY:
>                 if ($pf = $ewiki_plugins["action_binary"][$action]){
>                     if(EWIKI_PROTECTED_MODE && ewiki_auth($id, $data,
> $action, false, 1) ){
>                         return($pf($id, $data, $action));
>
>                     }else{
>                         return($ewiki_errmsg);
>                     }                
>                 }else{
>                     return(ewiki_t("DISABLEDPAGE")); 
>                 }
>         }
>     }
>
> Andy
>
> > > Just an early report that I'm seeing a bug in the new binary hook, I
> > added
> > > $ewiki_plugins["action_binary"]["info"] = "ewiki_page_info"; to my
> > config
> > > file and now all actions are allowed to run on the page.  I have to
> > leave
> > 
> > Haven't seen this happen. Have you forgotten to logout (if you were admin
> > during page flag setting).

Other related posts: