2
i think changing $_GET['list'] to $_POST['list'] may make it harder.
the rest i'm not sure about
i could be way out here, but what about line 39:
$pathstring .= $mytree->getNicePathFromId($cid, "title", "viewcat.php?op=");
adding stripslashes & trim to the path?
$pathstring .= stripslashes(trim($mytree->getNicePathFromId($cid, "title", "viewcat.php?op=")));
don't quote me on it though cos i'm certainly no programmer.. just a humble beginner.