Reply to Re: An elegant way to handle user-level assignable features?

Your name:

Reply:


Posted by Curtis on 12/30/05 01:38

J.O. Aho <user@example.net> wrote in message
news:41gpv6F1ef7l7U1@individual.net...
> Curtis wrote:
>
> > I'm looking for an elegant way for the calling software
to:
> >
> > a. inform our program of how many and what designation
of
> > usertypes are desired;
>
> A database is an excellent tool for this and you could
have
>
> table1: UserTypes(TypeID, TypeName) [Primary Key: TypeID]
> table2: Feature(FeatureID, FeatureName, ScriptFile)
[Primary Key: FeatureID]
> table3: FeatureForType(FeatureID,TypeID) [Primary Key:
FeatureID + TypeID]
>
>
> > b. say which features are assigned to which usertypes;
>
> That is done in table3.
>
>
> > c. for our software to cleanly test for what's what:
>
> As you will be storing username/logins somewhere, you can
then store the
> TypeID in that place too that the user in question has.
Here you have a bit of
> options how you make this value easy to access, one way is
to store this in a
> session.
>
> You can use a $_SERVER['PHP_SELF'] to see which file you
are accessing, then
> you can join table 2 and 3, looking for matching
ScriptFile and compare if
> TypeID that you get from the SQL query matches with the
current users TypeID,
> if not, then redirect with a nice header() them to another
page.
>

Many thanks for the feedback, J.O.

As it's now conceived, we'd like to keep the "Marx" package
(free, open-source text markup program--like BBCode or
Textile) generic.

What this means is that if (say) Drupal users want to
implement it for Drupal (or Mambo, or whatever), they would
have to implement the database provisions and CMS hooks in a
module which CALLS our program.

So what we're looking for, perhaps, at this stage, is how to
construct the INTERFACE to our program (which will not
utilize any database) in the most generic way possible to
encourage its easy use by most any CMS and forum package.

So far the code, about 1500 lines of PHP and fairly near the
alpha-usable stage, is written strictly as
procedural/function stuff, and the interface is simply
called like so:

$html = _marx_filter($marked_up_text);

and nothing more. I presume we'll want to wrap this in a
class or objectify the code in some way.

So we probably need to implement some structure in our code
to which the calling code would pass persistent information
about user levels and their feature assignments.

(I'm assuming that the CMS software would call Marx one
time, initialize those variables, and that anyone who used
it, say on a forum, would be sending their text through our
in-memory filter along with their user levels, i.e., that a
new instance of Marx would not be invoked every time.
Perhaps someone will correct me if this preconception is
mistaken.)

We have a website up for Marx, but are likely a couple of
weeks away from going live. Perhaps answering this will be
easier when the preliminary code is published.

We'll have a try-it-yourself page on the site, but would
like to have a few PHP experts have a look at the parts of
the code where we filter out attempts at maliciousness to be
sure they're adequate.

--

Curtis

Visit We the Thinking
www.wethethinking.com
An online magazine/forum
devoted to philosophical
thought.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация