From geeklog-modules-user at lrdesign.com Sun Apr 6 18:45:35 2003
From: geeklog-modules-user at lrdesign.com (Evan Dorn)
Date: Sun, 6 Apr 2003 15:45:35 -0700
Subject: [geeklog-modules] HELP REQ: Strange PHP behavior in GL
Message-ID: <7B3AFE2F-6881-11D7-AC7C-0003938301B0@lrdesign.com>
I'm trying to implement a hack to ping weblogs.com whenever a new story
is successfully submitted. I've hit a weird bug.
There are PHP objects I use that function fine on their own or in other
PHP scripts, but are broken if I use them from within Geeklog. I use
the XMLRPC implementation for PHP, but you don't necessarily have to
know anything about XMLRPC or it's PHP implementation to understand
this code or the problem. Just know that "xmlrpcval" is an object that
is serializable, and its behavior breaks if it's used from inside GL.
I can set and retrieve values in this object in any other PHP code, but
inside GL this object produces nothing when I set and then retrieve a
value.
The code fragment I'm running is:
function phpblock_rpcserialize()
{
include("xmlrpc.inc");
$v=new xmlrpcval("foobar","string");
$retval = "value is:
" . htmlentities($v->serialize()) .
"
";
return $retval;
}
xmlrpc.inc contains the definition of the xmlrpcval object.
Alternatively, I can just put the same code in its own PHP file, and
just use print $retval; for the last line.
In a plain PHP file, the code gives this output:
value is:
foobar
which is the XML output I expect from this object. But from inside a
phpblock (or any other place within GL), the same code gives a
different output:
value is:
Clearly, GL is somehow interfering with xmlrpcval's ability to function
correctly; either to set, store, or serialize values. I'm not sure if
I should be looking for GL identifiers that interfere with identifiers
in xmlrpc.inc, or what. I'm not so familiar with PHP that I have a
handle on whether variable scope could be an issue or not.
You can see these bits of code live. These two items have identical
code:
In a separate php file:
http://www.idahoev.com/vardemo.php
In a GL phpblock:
http://www.idahoev.com/ click on topic "Testing Grounds", and look
at the bottom-right block.
Any suggestions of what to look for would be appreciated.
Thanks,
IdahoEv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2135 bytes
Desc: not available
URL:
From geeklog-modules-admin at lists.geeklog.net Tue Apr 29 10:49:31 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Tue, 29 Apr 2003 16:49:31 +0200
Subject: [geeklog-modules] Plugins and comments
Message-ID: <20030429144931.14396@smtp.haun-online.de>
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/
From geeklog-modules-admin at lists.geeklog.net Tue Apr 29 12:36:48 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Tue, 29 Apr 2003 12:36:48 -0400
Subject: [geeklog-modules] Plugins and comments
References: <20030429144931.14396@smtp.haun-online.de>
Message-ID: <006d01c30e6d$878106b0$9a0a10ac@xpbl1>
Dirk,
PLG_handlePluginComment was added to lib-plugins to handle save and delete
of comments via the operation parameter. I'd agree with your suggestion. It
will call all plugins if the function exists.
Blaine
----- Original Message -----
From:
To:
Sent: Tuesday, April 29, 2003 10:49 AM
Subject: [geeklog-modules] Plugins and comments
> 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/
>
> _______________________________________________
> geeklog-modules mailing list
> geeklog-modules at lists.geeklog.net
> http://lists.geeklog.net/listinfo/geeklog-modules
From geeklog-modules-admin at lists.geeklog.net Wed Apr 30 00:07:18 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Wed, 30 Apr 2003 00:07:18 -0400
Subject: [geeklog-modules] Plugins and comments
References: <20030429170003.12998.88073.Mailman@internal.iowaoutdoors.org>
Message-ID: <001201c30ecd$ff04e020$e05af7a5@lm76>
"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:
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/
From geeklog-modules-admin at lists.geeklog.net Wed Apr 30 05:11:58 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Wed, 30 Apr 2003 11:11:58 +0200
Subject: [geeklog-modules] Plugins and comments
In-Reply-To: <001201c30ecd$ff04e020$e05af7a5@lm76>
References: <001201c30ecd$ff04e020$e05af7a5@lm76>
Message-ID: <20030430091158.2123@smtp.haun-online.de>
>I hope the redirects back to the main page on every action are
>addressed too for plugins.
Again, the problem here is that Geeklog doesn't really know where to
redirect to for the plugin.
Any suggestions?
The plugin could return the HTML for a redirect from
PLG_handlePluginComment().
Some pseudo code:
if (comment_type == 'article' || comment_type == 'poll')
geeklog_handles_it
else {
redirect = PLG_handlePluginComment()
if (empty (redirect)) // for compatibility
echo COM_refresh (site_url/index.php)
else
echo redirect
}
Does that make sense?
bye, Dirk
--
http://www.haun-online.de/
http://www.tinyweb.de/
From geeklog-modules-admin at lists.geeklog.net Wed Apr 30 13:37:59 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Wed, 30 Apr 2003 13:37:59 -0400
Subject: [geeklog-modules] Plugins and comments
References: <001201c30ecd$ff04e020$e05af7a5@lm76> <20030430091158.2123@smtp.haun-online.de>
Message-ID: <001201c30f3f$3f4441a0$f351f7a5@lm76>
Yes, exactly. Let the plugin feed the page to GL and if nothing
is provided then default back to the main page.
Joat
----- Original Message -----
From:
To:
Sent: Wednesday, April 30, 2003 5:11 AM
Subject: Re: [geeklog-modules] Plugins and comments
>I hope the redirects back to the main page on every action are
>addressed too for plugins.
Again, the problem here is that Geeklog doesn't really know where
to
redirect to for the plugin.
Any suggestions?
The plugin could return the HTML for a redirect from
PLG_handlePluginComment().
Some pseudo code:
if (comment_type == 'article' || comment_type == 'poll')
geeklog_handles_it
else {
redirect = PLG_handlePluginComment()
if (empty (redirect)) // for compatibility
echo COM_refresh (site_url/index.php)
else
echo redirect
}
Does that make sense?
bye, Dirk
--
http://www.haun-online.de/
http://www.tinyweb.de/
_______________________________________________
geeklog-modules mailing list
geeklog-modules at lists.geeklog.net
http://lists.geeklog.net/listinfo/geeklog-modules
From geeklog-modules-admin at lists.geeklog.net Wed Apr 30 14:07:03 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Wed, 30 Apr 2003 14:07:03 -0400
Subject: [geeklog-modules] slogan plugin
Message-ID: <20030430180703.GA6088@hadron.dyndns.org>
Hi,
Anyone know where I can find the slogan plugin ?
It is referenced in the universal plugin as sample code, but not
included in the distribuition.
It would reall help me understand all of this stuff.
Thanks!
--
Aaron St. Pierre
asp at tlm.net
Men are always ready to respect anything that bores them.
-- Marilyn Monroe
From geeklog-modules-admin at lists.geeklog.net Wed Apr 30 17:10:32 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Wed, 30 Apr 2003 21:10:32 +0000
Subject: [geeklog-modules] slogan plugin
In-Reply-To: <20030430180703.GA6088@hadron.dyndns.org>
References: <20030430180703.GA6088@hadron.dyndns.org>
Message-ID: <20030430205431.M81282@pigstye.net>
On Wed, 30 Apr 2003 14:07:03 -0400, geeklog-modules-admin wrote
> Hi,
> Anyone know where I can find the slogan plugin ?
> It is referenced in the universal plugin as sample code, but not
> included in the distribuition.
>
> It would reall help me understand all of this stuff.
>
> Thanks!
> --
> Aaron St. Pierre
> asp at tlm.net
>
> Men are always ready to respect anything that bores them.
> -- Marilyn Monroe
> _______________________________________________
> geeklog-modules mailing list
> geeklog-modules at lists.geeklog.net
> http://lists.geeklog.net/listinfo/geeklog-modules
Here is where you can get the slogan plugin.
http://www.pigstye.net/files/slogan_0.1_1.3.7.tar.gz.
It is as basic as it can get with no admin or user interfaces. It does not
have my list of rotating slogans, but it does illustrate the use of the
universal plugin. If you want the list of slogans ask off list and I will
send it to you.
One thing of interest -- all the plugin does it select a random slogan from
the database and display it on each page. I have gotten more hits from
google concerning the different slogans than any other single topic. The
slogan hits average about 25 a day.
--
Tom Willett
tomwATpigstye.net
From geeklog-modules-admin at lists.geeklog.net Wed Apr 30 17:32:10 2003
From: geeklog-modules-admin at lists.geeklog.net (geeklog-modules-admin at lists.geeklog.net)
Date: Wed, 30 Apr 2003 17:32:10 -0400
Subject: [geeklog-modules] slogan plugin
In-Reply-To: <20030430205431.M81282@pigstye.net>
References: <20030430180703.GA6088@hadron.dyndns.org> <20030430205431.M81282@pigstye.net>
Message-ID: <20030430213210.GB6088@hadron.dyndns.org>
Thanks for the link! FWIW, I was able to get the skeleton plugin up and
running in no time. More importantly, I am starting to see how things
are working. Anyway thanks for the help and I will post soon, I am sure!
:)
aaron
In another life geeklog-modules-admin at lists.geeklog.net wrote:
> On Wed, 30 Apr 2003 14:07:03 -0400, geeklog-modules-admin wrote
> > Hi,
> > Anyone know where I can find the slogan plugin ?
> > It is referenced in the universal plugin as sample code, but not
> > included in the distribuition.
> >
> > It would reall help me understand all of this stuff.
> >
> > Thanks!
> > --
> > Aaron St. Pierre
> > asp at tlm.net
> >
> > Men are always ready to respect anything that bores them.
> > -- Marilyn Monroe
> > _______________________________________________
> > geeklog-modules mailing list
> > geeklog-modules at lists.geeklog.net
> > http://lists.geeklog.net/listinfo/geeklog-modules
>
> Here is where you can get the slogan plugin.
>
> http://www.pigstye.net/files/slogan_0.1_1.3.7.tar.gz.
>
> It is as basic as it can get with no admin or user interfaces. It does not
> have my list of rotating slogans, but it does illustrate the use of the
> universal plugin. If you want the list of slogans ask off list and I will
> send it to you.
>
> One thing of interest -- all the plugin does it select a random slogan from
> the database and display it on each page. I have gotten more hits from
> google concerning the different slogans than any other single topic. The
> slogan hits average about 25 a day.
>
>
> --
> Tom Willett
> tomwATpigstye.net
> _______________________________________________
> geeklog-modules mailing list
> geeklog-modules at lists.geeklog.net
> http://lists.geeklog.net/listinfo/geeklog-modules
--
Aaron St. Pierre tel: 978.828.6177
asp at tlm.net
Usage: fortune -P [-f] -a [xsz] Q: file [rKe9] -v6[+] file1 ...