This file hasn't changed since 2.2.6. But what you're seeing looks very familure to what I saw with the template backup system.
And I think version 2.2.6 fixes what you're seeing in template.php. You'll need to incorporate my changes into 2.2.6's changes (see below).
Can you compare your code against 2.2.9 again--especially the query at line 471.
This is what those lines should look like:
Code:
$templates=$DB_site->query("SELECT t1.title AS title,t2.templateid, NOT ISNULL(t2.templateid) AS found" . iif(isset($searchstring), ",INSTR(t1.".$searchtype.",'".addslashes($searchstring)."') AS globalcontain,INSTR(t2.".$searchtype.",'".addslashes($searchstring)."') AS localcontain","")."
FROM template AS t1
LEFT JOIN template AS t2 ON (t1.title=t2.title AND t2.templatesetid=$templateset[templatesetid])
WHERE t1.templatesetid=-1 AND t1.title<>'options'
ORDER BY t1.title");
Let me know if this works. I can also post the full set
of changes against 2.2.9 (mine and TommyBoy's) for this hack since it's been so long.
Be sure you to use the code in this post. I had to edit this post.
(Not that it matters, but the file really did change in 2.2.8--fixed a bug that TommyBoy found 10 months ago and has long been in my code.)