#
#-----[ Find ]-----
#
return($catlist);
//子版面外掛所增加的===================================
//forum_sub start
function get_sub_list($id)
{
global $db;
$sql="select cat_id,cat_title from ".CATEGORIES_TABLE." order by cat_order ";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
}
$cat_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$cat_data[] = $row;
}
$db->sql_freeresult($result);
$sql = "SELECT cat_id,forum_id,forum_name,sort_sub,forum_sub from ".FORUMS_TABLE." ORDER BY cat_id,forum_order";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
}
$forum_data = array();
$forum_sub = array();
$forum_sub2 = array();
while( $row = $db->sql_fetchrow($result) )
{
$s="";
if($row[forum_sub]==0)
{
$forum_data[$row['cat_id']][] = $row;
}
else
{
if ($row[forum_id] == $id)
{
$s = " selected="selected"";
}
$forum_sub[$row['forum_sub']][] = "add_select('".$row[cat_id].",".$row[forum_id].",".$row[sort_sub]."','".$row[forum_name]."','$s',".($row[sort_sub]+1).");";
$forum_sub2[$row['forum_sub']]=$row[forum_id];
}
}
$db->sql_freeresult($result);
$sub_list="";
for( $i=0;$i<count($cat_data);$i++)
{
$s = "";
$cat_id=$cat_data[$i][cat_id];
$sub_list .="add_select('".$cat_id.",0,0','".$cat_data[$i][cat_title]."','$s',0);";
for($j=0;$j<count($forum_data[$cat_id]);$j++)
{
$s = "";
if ($forum_data[$cat_id][$j][forum_id] == $id)
{
$s = " selected="selected"";
}
$sub_list .= "add_select('".$forum_data[$cat_id][$j][cat_id].",".$forum_data[$cat_id][$j][forum_id].",".$forum_data[$cat_id][$j][sort_sub]."','".$forum_data[$cat_id][$j][forum_name]."','$s',".($forum_data[$cat_id][$j][sort_sub]+1).");";
if ( count($forum_sub[$forum_data[$cat_id][$j][forum_id]]) > 0 )
{
$sub_list.= implode(' ', $forum_sub[$forum_data[$cat_id][$j][forum_id]]);
$sub_list.=sub_search($forum_sub2[$forum_data[$cat_id][$j][forum_id]],$forum_sub,$forum_sub2);
}
}
}
return $sub_list;
}
//forum_sub end
//=====================================================
}
#
#-----[ Replace With ]-----
#
return($catlist);
}
//子版面外掛所增加的===================================
//forum_sub start
function get_sub_list($id)
{
global $db;
$sql="select cat_id,cat_title from ".CATEGORIES_TABLE." order by cat_order ";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
}
$cat_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$cat_data[] = $row;
}
$db->sql_freeresult($result);
$sql = "SELECT cat_id,forum_id,forum_name,sort_sub,forum_sub from ".FORUMS_TABLE." ORDER BY cat_id,forum_order";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
}
$forum_data = array();
$forum_sub = array();
$forum_sub2 = array();
while( $row = $db->sql_fetchrow($result) )
{
$s="";
if($row[forum_sub]==0)
{
$forum_data[$row['cat_id']][] = $row;
}
else
{
if ($row[forum_id] == $id)
{
$s = " selected="selected"";
}
$forum_sub[$row['forum_sub']][] = "add_select('".$row[cat_id].",".$row[forum_id].",".$row[sort_sub]."','".$row[forum_name]."','$s',".($row[sort_sub]+1).");";
$forum_sub2[$row['forum_sub']]=$row[forum_id];
}
}
$db->sql_freeresult($result);
$sub_list="";
for( $i=0;$i<count($cat_data);$i++)
{
$s = "";
$cat_id=$cat_data[$i][cat_id];
$sub_list .="add_select('".$cat_id.",0,0','".$cat_data[$i][cat_title]."','$s',0);";
for($j=0;$j<count($forum_data[$cat_id]);$j++)
{
$s = "";
if ($forum_data[$cat_id][$j][forum_id] == $id)
{
$s = " selected="selected"";
}
$sub_list .= "add_select('".$forum_data[$cat_id][$j][cat_id].",".$forum_data[$cat_id][$j][forum_id].",".$forum_data[$cat_id][$j][sort_sub]."','".$forum_data[$cat_id][$j][forum_name]."','$s',".($forum_data[$cat_id][$j][sort_sub]+1).");";
if ( count($forum_sub[$forum_data[$cat_id][$j][forum_id]]) > 0 )
{
$sub_list.= implode(' ', $forum_sub[$forum_data[$cat_id][$j][forum_id]]);
$sub_list.=sub_search($forum_sub2[$forum_data[$cat_id][$j][forum_id]],$forum_sub,$forum_sub2);
}
}
}
return $sub_list;
}
//forum_sub end
//=====================================================