Page 1 of 1

plugin freetag, related tags bug (<)

Posted: Sat Jun 25, 2011 7:42 pm
by Timbalu
This (array) inside foreach disables non-array warnings and produces a fatal '<' => 0 tags content.

Code: Select all

1309 	foreach((array)$rows as $r) {
replace function with added if(is_array($rows)):

Code: Select all

    #
    # descend: if true, get the related tags of the related tags of given tag
    #
    function getTagCloudTags($tag, $descend = true) {
        $rows = serendipity_db_query($this->getTagCloudQuery('', $tag));
        if(is_array($rows)) {
            foreach($rows as $r) {
                $tags[$r['tag']] = $r['total'];

                #get also tags which are related only by other tags
                if($descend) {
                    $descended_tags = $this->getTagCloudTags($r['tag'], false);
                    foreach($descended_tags AS $dtag => $value) {
                        $descended_tags[$dtag] = $value / 2;
                    }
                    $tags = array_merge($tags, $descended_tags);
                }
            }
        }
        unset($tags["$tag"]);
        return $tags;
    }

Re: plugin freetag, related tags bug (<)

Posted: Sun Jun 26, 2011 11:51 am
by garvinhicking
Hi!

Good catch! Thanks!

Regards,
Garvin

Re: plugin freetag, related tags bug (<)

Posted: Sun Jun 26, 2011 12:30 pm
by Timbalu
ops, thats even better ;-)

Code: Select all

        unset($tags["$tag"]);
        return $tags;
        }
    }