project
project summary freshmeat entry development infos mailing list WebInstaller database tools ChangeLog
page plugins
ProtectedEmail PowerSearch README README.config README.plugins README.fragments ProtectedMode INTERNALS WordIndex AboutPlugins PhpInfo OrphanedPages ListOfPluginHooks RSS RecentChanges PageIndex NewestPages SearchPages MostVisitedPages MostOftenChangedPages UpdatedPages
usage hint
9OTUNE YOGURT SÜREER AYRAN OLANA KADAR SİKERİMxD
The lib/uservars_pages plugin allows you to store user data as we had disscussed here.
There are two levels to the SessionVariablesAPI, light and full. The Light interface is intended for non-management uses i.e. plugins that do not need to search or edit other user's data. Both are implemented by plugins in the plugins/lib directory.
Light API
$ewiki_plugins['uservars_retrieve'] should be called through by auth plugins after they have set $ewiki_auth_user. $ewiki_plugins['uservars_store'] should be called by plugins after they have changed values.
Full API (extends the Light API)
- $ewiki_plugins['uservars_store']($data=NULL, $username=NULL)
- Saves $data as data for user of name $username or ewiki_auth_user if NULL. See light API if both are NULL.
- $ewiki_plugins['uservars_retrieve']($username=NULL)
- Returns the user data for user of name $username or $ewiki_auth_user if NULL.
- function ewiki_get_uservar($varname, $defaultValue=NULL, $username=NULL)
- returns value of user variable $varname or $defaultValue if it is not set.
- function ewiki_set_uservar($varname, $value, $username=NULL)
- set value of user variable $varname returns true on success
- function ewiki_getall_uservar($username=NULL)
- returns all uservariables for a user as an array.
- function ewiki_clear_uservar($varname, $username=NULL)
- unsets value of user variable $varname returns true on success
- function ewiki_search_uservar($varname, $value=NULL)
- returns array of $username => $value for users that have user variable $varname set (and equal to $value if $value is set)
$username is optional in all calls defaulting to the current $ewiki_auth_user. The uservars_pages implementation stores these variables on specially named pages, it is not efficient (especially on searches) but it should prove a good starting point. I have some simple interfaces to release and I should have some plugins based on these calls soon.
I've added or would like to add to these:
- For login features:
- $ewiki_plugins["Page"]["Login"]
- $ewiki_plugins["Page"]["Logout"] - for system login/logout pages where available.
- For session and user variables in cases like the new e-mail protect method and instead of using cookies directly. Cookie based implementations would be included in ewiki.php.
- I want to add these so that I can build off my SecurePlugin account functions for things like an *AnnouncementPlugin or a *PersonalHistoryPlugin without coupling them to my user system.
Andy: I finally got this, you mean like $GLOBALS["ewiki_author"] right? The problem with that is that I don't think the wrapper should know all about every plugin that you have loaded. I think your solution of grabbing a couple of global variables and making them arrays covers that perhaps. Anything you can say about what the PostProject entails?
Andy: I definately don't want the checks for the existance of the plugin, in fact, that's exactly why I want it in the core. What I was hoping to do was something like the render plugin where a simple implementation is included in the core and all plugins can call it or replace it as they might need to. Perhaps a separate plugin and include_once() or require_once() would serve all the same needs if that seems better to you.
Andy: I hadn't meant for them to be empty, just simple and cookie based. Unfortunately my best experience is object oriented so I don't have the same sense of outrage with regard to empty functions. The getter/setter function stems from the same line of thought of course.
Andy: Sure, although cookies can substitute for session variables and can store data on a particular machine nearly indefinately they cannot truly be associated with a user. The *AnnouncementPlugin provides an example of this. Consider that the announcement plugin prefaces the first page a user visits with an announcement page if that announcement is newer than the last one they viewed. With long-term cookies the user would see this announcement at each computer they visit from. If the wiki they visit has instead replaced *_var with functions that actually understand users the same function would now display the announcement only once. Having a replaceable functions allows the *AnnoucementPlugin, the authentication plugin, and the wrapper to be mutually unaware. A variable array does or nearly does the same.
Andy: I think you're onto something. If I stay awake long enough I'll write up a plan for RemappingVariables. Not that I think we should jump everything to a new style but I want to see where things would go if they did move. I kind of jumped at the plugin function to match the existing style of plugin functions.
Andy: The E-mail plugin is using cookies already and I'd like to apply whatever we do in this regard to that. The plugins that I forsee using this are:
- email_protect - to show its message only once
- phplib_auth - internal use.
- edit_savesize - I have a request that the effect of the + on the edit screen be maintained between visits. I would use this mechanism to meet that request.
- view_announce - to indicate the last announcement seen, I'll probably code this because I'm inviting my users to bookmark pages for their departments.
- page_history - to store a list of the pages that a visitor has visited.
Andy: Yeah a + a - and a hidden field to store the current value.
Andy: Well, I sure don't want a cookie function but one would make those plugins functional for those with no other choice.
Andy: It's 11:30pm now, I'll vote after I sleep... whenever that may be.
Andy: Still haven't slept (9:30am) but here's the other thing we need to think about, how do we specify the three to five different retention policies? (constant, variable, session var, machine var, user var). I've started laying out the problem on RemappingVariables, but I didn't get far.