new bug in free-tag-plugin

Found a bug? Tell us!!
Post Reply
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

new bug in free-tag-plugin

Post by stm999999999 »

Hello,

I updated the plugin via Spartacus today and there is a little bug:

In the tag-cloud in the sidebar, the path in the tag-links has an error:

http://blog.stephan.manske-net.de/

the links are relative to the actual path, so on the main page the link for the tag test shows to http://blog.stephan.manske-net.de/test and not to http://blog.stephan.manske-net.de/plugin/tag/test On a category page it shows to http://blog.stephan.manske-net.de/categories/test

In the footer, the "tags for this article" is always correct.
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: new bug in free-tag-plugin

Post by garvinhicking »

Hi!

What did you configure as the base taglink in the freetag plugin config?

Where exactly does the wrong link show up, can you give me an exact URL?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Re: new bug in free-tag-plugin

Post by stm999999999 »

What did you configure as the base taglink in the freetag plugin config?
In the event plugin?

http://blog.stephan.manske-net.de/plugin/tag/
Where exactly does the wrong link show up, can you give me an exact URL?
As I said:

Go to http://blog.stephan.manske-net.de/, on the sidebar are the tags. They shows to http://blog.stephan.manske-net.de/bla

Go to a category http://blog.stephan.manske-net.de/categories/19-test4, they shows to http://blog.stephan.manske-net.de/categories/bla

go to an article http://blog.stephan.manske-net.de/archives/3-twssw.html they show to http://blog.stephan.manske-net.de/archives/bla

BUT, the tags in the footer of this article are correct!
http://blog.stephan.manske-net.de/plugin/tag/test

And this is the same, when you see the article on the main page http://blog.stephan.manske-net.de/archives/P2.html
Ciao, Stephan
Rexxer
Regular
Posts: 62
Joined: Sat Oct 22, 2005 11:10 am

Re: new bug in free-tag-plugin

Post by Rexxer »

garvinhicking wrote:Hi!

What did you configure as the base taglink in the freetag plugin config?

Where exactly does the wrong link show up, can you give me an exact URL?

Best regards,
Garvin
I can confirm this bug. I configured the 'Taglink' to be http://www.compyblog.de/index.php?/plugin/tag/ but my blog shows the links in the tagcloud (via sidebar plugin) on my blog as http://www.compyblog.de/Abmahnwellen etc.

It looks like the sidebar plugin for tagging is not completely adapted to the event plugin. This is serendipity_plugin_freetag version 2.37 and serendipity_event_freetag version 2.61.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: new bug in free-tag-plugin

Post by garvinhicking »

Hi!

Ah, okay. The sidebar plugin could not get the taglink configuration option from the event plugin, thus I needed to insert the config option to the sidebar plugin as well.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

OK, I think I have the source of the error:

It ist the new feature to config the path manualy.

The tag cloud for the sidebar is called from plugin_freetag.php

It uses for the displaying a function in event_freetag.php.

In these function there is a piece of code which is in all of the functions in these file:

Code: Select all

    function displayTags($tags, $xml, $nl, $scaling, $maxSize = 200, $minSize = 100)
    {
        global $serendipity;
        static $taglink = null;

        if ($taglink == null) {
            $taglink = $this->get_config('taglink');
        }
But in these special function $this->get_config('taglink') is empty. I think, because the function is called in the context of plugin_freetag, which did not know taglink. :-( So $this-> seems to be the wrong way - but is there a possibility to access the config of event_freetag with another php-construct?

by the way: In what way are all these config options saved in s9y? What do s9y open to read out the saved options?
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

stm: Yes, that was what I meant :)

I think there is a way to retrieve the event plugin config option, some other bundled plugins do that - but it was too complicated for me to look into right now, so I went the easier route.
by the way: In what way are all these config options saved in s9y? What do s9y open to read out the saved options?
They are all stored in the serendipity_config DB table, and saved by the primary key association of the plugin's ID.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

stm: Yes, that was what I meant :)
Yeah, but I begin to write my post before you post yours - but it takes some time to end my post :-)
I think there is a way to retrieve the event plugin config option, some other bundled plugins do that - but it was too complicated for me to look into right now, so I went the easier route.
Can you tell me one (ore more!) of these bundled plugins? Perhaps I have the time
Ciao, Stephan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
Can you tell me one (ore more!) of these bundled plugins? Perhaps I have the time
The "user self-registration" plugin is the most obvious, I think.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

Hm, I would think these is responsable for the cross-over using of config variables:

Code: Select all

                       // Get the config from the sidebar plugin
                        $pair_config = array(
                            'userlevel'       => USERLEVEL_EDITOR,
                            'no_create'       => false,
                            'right_publish'   => false,
                            'instructions'    => $this->get_config('instructions', ''),
                            'usergroups'      => array(),
                            'straight_insert' => false
                        );
                        $config = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}config WHERE name LIKE 'serendipity_plugin_adduser:%'");

                        if (is_array($config)) {
                            foreach($config AS $conf) {
                                $names = explode('/', $conf['name']);
                                if ($names[1] == 'instructions' && !empty($pair_config['instructions'])) {
                                    continue;
                                }

                                if ($names[1] == 'usergroups') {
                                    $ug = (array)explode(',', $conf['value']);

                                    foreach($ug AS $cid) {
                                        if ($cid === false || empty($cid)) {
                                            continue;
                                        }
                                        $pair_config[$names[1]][$cid] = $cid;
                                    }
                                } else {
                                    $pair_config[$names[1]] = serendipity_get_bool($conf['value']);
                                }
                            }
                        }

So, code like this can be helpfull:

Code: Select all

// Get the config from the sidebar plugin
$pair_config_taglink = null;

$config = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}config WHERE name LIKE 'serendipity_event_freetag:%taglink'");
if (is_array($config)) {
    foreach($config AS $conf) {
        $names = explode('/', $conf['name']);
        if ($names[1] == 'taglink' && empty($pair_config_taglink)) {
           $pair_config_taglink = ($conf['value']);
        }
    }
}
Ciao, Stephan
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

I tryed the code at http://nopaste.php-q.net/228734 in the event_freetag.php V2.61 and it worked fine! No need to config taglink in both configs!
Ciao, Stephan
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

Is the code wrong?
Ciao, Stephan
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

Thanks for your code snippet, works as expected. Only issue I got was that I had to make the query more general because I only found a serendipity_PLUGIN_freetag entry in my DB ... and no serendipity_EVENT_freetag (however, it's my local dev blog, so some things might be broken there):

Code: Select all

$result_taglink = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}config WHERE name LIKE '%freetag%taglink'");
Cheers
- Mattsches
Post Reply