各カテゴリ直下のカテゴリが無い場合のテーブル表示エラー修正

PHP版Yomi-Searchのバグで、各カテゴリ直下にサブカテゴリが無い場合もテーブルタグを無駄に表示してしまいます。

余計なHTMLは検索エンジンがクロールをスムーズに行う際に、邪魔になります。

下記に方法で比較的に簡単に修正できます。

functions.phpの90行目#直下カテゴリを表示から127行目までを修正 (青追加、赤削除)

function print_subcategory($category,$num,$column) {
global $cfg, $db;
echo "\n<center><table width=\"90%\" id=mid>";
$td_flag=0;
$tr_flag=1;
$query = "SELECT id FROM $cfg[sqltb]category WHERE path='$category'";
$id = $db->single_num($query) or $db->error("Query failed $query".__FILE__.__LINE__);
$query = "SELECT title, path FROM $cfg[sqltb]category WHERE up_id='$id[0]' ORDER BY path";
$rowset = $db->rowset_assoc($query) or $db->error("Query failed $query".__FILE__.__LINE__);
//サブカテが無い場合、非表示
if($rowset[0] != ""){
echo "\n<center><table width=\"90%\" id=mid>";
$print_subcategory_footer ="</td></tr>\n</table></center>";
}else{
$print_subcategory_footer ="";
}

foreach ($rowset as $row) {
list($count, $check) = subcategory($row[path]);
if($tr_flag == 0){echo "</td></tr>"; $tr_flag = 1;}
if($tr_flag == 1){echo "\n<tr><td>"; $td_flag = 1;}
else{echo "</td>\n<td>";}
echo " ■<a href=\"$cfg[script]?mode=dir&amp;path=$row[path]\">$row[title]";
if($check){echo "*";}
echo "</a>";
if($num){echo"<i>($count)</i>";}
if($tr_flag < $column){$tr_flag++;}
else{$tr_flag = 0;}
}
$query = "SELECT title, path FROM $cfg[sqltb]category WHERE reffer LIKE '%&$id[0]&%' ORDER BY path";
$rowset = $db->rowset_assoc($query) or $db->error("Query failed $query".__FILE__.__LINE__);
foreach ($rowset as $row) {
$id = substr($row[path], 0, -1);
list($count, $check) = subcategory($id);
if($tr_flag == 0){echo "</td></tr>"; $tr_flag = 1;}
if($tr_flag == 1){echo "\n<tr><td>"; $td_flag = 1;}
else{echo "</td>\n<td>";}
echo " ■<a href=\"$cfg[script]?mode=dir&amp;path=$row[path]\">$row[title]@</a>";
if($num){echo"<i>($count)</i>";}
if($tr_flag < $column){$tr_flag++;}
else{$tr_flag = 0;}
}
echo "</td></tr>\n";
echo "</table></center>";
//サブカテが無い場合、非表示
echo $print_subcategory_footer;

}