[geeklog-modules] Plugins and comments

geeklog-modules-admin at lists.geeklog.net geeklog-modules-admin at lists.geeklog.net
Wed Apr 30 00:07:18 EDT 2003


"So how are plugins handling deletion of comments currently?"

I added comments to one of my plugins.  Their deletion has been
handled using the API as currently written.  Looking at the code
though I see the reason we have had no problems is because
everyone who has admin privileges right now also has story.edit
permission.  As a test when I removed the latter permission, yes
the delete link doesn't display.  Your approach to fixing it
looks fine to me.

I hope the redirects back to the main page on every action are
addressed too for plugins.  I ended up having to hack a few
places so it wouldn't keep taking people back there when using
it.



----- Original Message -----
Message: 1
To: <geeklog-modules at lists.geeklog.net>
Date: Tue, 29 Apr 2003 16:49:31 +0200
Organization: Terra Software Systems
From: geeklog-modules-admin at lists.geeklog.net
Subject: [geeklog-modules] Plugins and comments
Reply-To: geeklog-modules at lists.geeklog.net

Well, it seems we still have some problems with plugins and
comments.
Take this, for example (from comments.php):

function deletecomment($cid,$sid,$type)
{
    global $_TABLES, $_CONF, $_USER, $REMOTE_ADDR;

    if (!empty ($sid) && !empty ($cid) && is_numeric ($cid)) {
        $result = DB_query ("SELECT o
wner_id,group_id,perm_owner,perm_group,perm_members,perm_anon
FROM
{$_TABLES['stories']} WHERE sid = '{$sid}'");
        $P = DB_fetchArray ($result);
        if (SEC_hasAccess ($A['owner_id'], $A['group_id'],
$A['perm_owner'], $A['perm_group'], $A['perm_members'],
$A['perm_anon'])
== 3) {


Ignore that stupid typo ("$P = DB_fetchArray" should be "$A =
...") for
the moment. The problem here is that this code prevents deletion
of
comments from anything but stories.

So how are plugins handling deletion of comments currently? A bit
further
down in comments.php, this function is called:

    PLG_handlePluginComment($type,$sid,'delete');

But, of course, as things are now, this will never be called.

Since Geeklog can't really know how the plugin's tables are named
and how
(if at all) it handles permissions, I'd suggest that Geeklog
should leave
the deletion of comments entirely to plugins, i.e. something
like:

    if (comment_type == 'article' || comment_type == 'poll')
        geeklog_handles_it
    else
        let_the_plugin_handle_it

Comments?

bye, Dirk


--
http://www.haun-online.de/
http://mypod.de/





More information about the geeklog-modules mailing list