<?
/////////////////////////////////////////////////////
//  险情文章管理 1.0正式版本--php文本存储格式      //
//  作者：上海财经大学99国际工管    险情           //
//  email：indraw@sina.com                         //
//  qq：   30467826                                //
//  技术支持：http://shcj.51.net/wdb               //
//  最新演示：http://xqart.126.com                 //
//  2002/4/10                                      //
//  最新下载地址 http;//shcj.51.net/wdb            //
/////////////////////////////////////////////////////
require("head.php");
require("config.php");
require("xqfunc.php");
//////////////////检查文章是否存在，并且读入数组////////////////////////////

echo "<title>文章管理</title>\n";
echo "<center>\n";
echo "<table border=0 bgcolor=#eeeeee cellspacing=0 cellpadding=3 width=100%>\n";
echo "<tr bgcolor=#eeeeee>\n";
echo "<td class=shadow2>\n";

echo "<img src=../images/arrow2.gif>\n";
echo "<a class=shadow2 href=index.php>文章首页</a>　\n";
$total_file=0;
$list_file=0;
$file_sort=file("data/"."xq.php");
$file_count=count($file_sort)-1;
for ($i=0;$i<=$file_count;$i++) {
        $file_name=explode("|",$file_sort[$i]);
        $total_file=$total_file+$file_name[4];
        if ($file_name[1]==$form) {
        $form_name= $file_name[2];
        $form_com= $file_name[3];
        static $msg;
        for ($j=$i+1;$j<=$file_count;$j++) {
            $file_typename=explode("|",$file_sort[$j]);
            if ($file_typename[0]=="form"){
           break;            }
            $list_file=$list_file+$file_typename[4];
            $type_list[]=$file_typename[1];
            $msg.="&nbsp;<img src=../images/arrow3.gif>&nbsp;<a class=shadow2 href=list.php?form=$form&type=$file_typename[1]>$file_typename[2]</a>";
            }  }

        if ($file_name[1]==$type)
        {$type_file=$file_name[4];
        $type_name=$file_name[2];
        $type_com=$file_name[3] ;
        }
        else if ($file_name[0]=="form" and $file_name[1]!=$form)
        echo "<img src=../images/arrow5.gif>&nbsp;<a class=shadow2 href=listform.php?form=$file_name[1]>$file_name[2]</a>　\n";
        else if ($file_name[1]==$form)
        echo "<img src=../images/arrow.gif>&nbsp;<b>$file_name[2]</b>\n";
        }
echo "</td>\n";
echo "</tr>\n";
echo "<tr>";
echo "<tr bgcolor=#003333>";
echo "<td>";
echo "</td>";
echo "<tr>";
echo "<tr bgcolor=$fuse_color>\n";
echo "<td class=shadow2>\n";
echo  $msg;
echo "</td>\n";
echo "</tr>\n";
echo "<tr>";
echo "<tr bgcolor=#cccccc>";
echo "<td>";
echo "</td>";
echo "<tr>";
echo "</table>\n";

echo "<table border=0  cellspacing=0 cellpadding=3 width=735><tr><td>\n";
echo "&nbsp;>> $form_name - $form_com\n";
echo "</td></tr></table>";

$type_file=chop($type_file);
echo "<table border=0 cellpadding=10 cellspacing=0 style='border-collapse:collapse' bordercolor=#$main_color width=735>\n";
echo "<tr>\n";
echo "<td class=shadow2 width=190 valign=bottom>\n";
echo "<img src=../images/arrow3.gif> 文章总数/文章分类：<b><font color=red>$list_file</font>/$total_file</b>";
echo "</td>\n";
echo "</td>\n";
echo "<form method='post' action='search.php'>";
echo "<td align=right valign=bottom>\n";
echo "<img src='./images/search.gif' width=16 heigth=16> ";
echo "标题<input type=checkbox name=title value='1' ";
echo ">\n";
echo "内容<input type=checkbox name=text value='1' ";
echo ">\n";
echo "<input class=border type=text name=keyword size=12 style='color:#000000; background-color:$fuse_color'>\n";
echo "<select size=1 name=searchtype style='color:#000000; border-style:solid; border-width:1; background-color:$fuse_color'>\n";
echo "<option value='all'>-=所有分类=-</option>";
for ($i=0;$i<=$file_count;$i++) {
        $file_name=explode("|",$file_sort[$i]);
        if ($file_name[0]=="type")
        echo "<option value=".$file_name[1].">".$file_name[2]."</option>";
        }
echo "</select> \n";
echo "<input class=border type=submit value=搜索 name=search style='color: #000000; background-color: $main_color'>\n";
echo "</td>";
echo"</form>";
echo "</tr>\n";
echo "</table>\n";
////////////以下为分页显示文章///////////////////////////////////
echo "<table border=0 cellspacing=0 style='border-collapse:collapse' width=735 height=233 cellpadding=3>\n";
echo "<tr>\n";
echo "<td width=60% height=233 valign=top>\n";
$type_each_count=count($type_list)-1;
//////////////将个2级分类汇总，排序////////////////////////////////
for ($i=0;$i<=$type_each_count;$i++){
$filelist_array1=file("data/$type_list[$i]/list.php");
     $type_each_count1=count($filelist_array1)-1;
     for ($j=0;$j<=$type_each_count1;$j++){
     $filelist_name1=explode("|",$filelist_array1[$j]);
     $filelist_array2[$filelist_array1[$j]]=$filelist_name1[0];  }
  }
@asort($filelist_array2);
@reset($filelist_array2);
$total_file=count($filelist_array2);
for ($counter=1; $counter<=$total_file; $counter++) {
    $filelist_array[]=key($filelist_array2);
    if (!(next($filelist_array2))) break;
    }
////////////////////////////////////////////////////////////
$recnum = $page_list_pg;
$listnum = 10;
$totalnum = intval(($total_file)/$recnum)+1;

echo "<table border=1 cellpadding=3 cellspacing=0 style='border-collapse:collapse' bordercolor=$main_color width=100%>\n";
echo "<tr>\n";
echo "<td width=100% align=right>\n";
page_menu($totalnum);
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
/////////////////////////////////////////
echo "<center><table border=0 bgcolor=\"$fuse_color\" cellspacing=1 cellpadding=1 width=100%>\n";

if ( !$p ) { $p = 1; }
        for( $i = $total_file-(($p-1)*$recnum); $i > $total_file-($p*$recnum);$i--) {
                $filelist_name=explode("|",$filelist_array[$i]);
  if ( "$filelist_name[0]" && "$filelist_name[0]" != '.' && "$filelist_name[0]" != '..') {
  $NO = $i+1;
  $xqfile_array=file("data/$filelist_name[1]/$filelist_name[0].num");
  $xqfile_info=explode("|",$xqfile_array[0]);

  $len = strlen($xqfile_info[1]);
  if ($len <= $page_list_code)
    $title = $xqfile_info[1];
  else
    $title =substr($xqfile_info[1],0,$page_list_code)."...";
  echo "<tr><td width=22 height=\"22\"align=center bgcolor=\"$fuse_color\" onmouseover=\"this.bgColor='white';\" onmouseout=\"this.bgColor='$fuse_color';\">";
  echo "$NO</td>";
  echo "<td height=\"22\" bgcolor=\"white\" onmouseover=\"this.bgColor='$fuse_color';\" onmouseout=\"this.bgColor='white';\">";
  echo "</b><a target=_blank href='show.php?type=$filelist_name[1]&id=$xqfile_info[0]'><span style=font:9pt>$title</span></a>";
  if (!empty($xqfile_info[5])) {
        $FILE = split("\.", $xqfile_info[5]);
        $FILE_count=count($FILE);
        $ftype = GET_FILE_TYPE($FILE[$FILE_count-1]);
echo ".<a href=\"artdown.php?type=$filelist_name[1]&id=$xqfile_info[0]\" target=blank><IMG border=0 SRC='images/file/$ftype'></a>/$xqfile_info[19]\n";
}
  if ($xqfile_info[2]!="")
  echo " - <font color=#c0c0c0>$xqfile_info[2]/文 </font>";
  $xqfile_time=explode(" ",$xqfile_info[6]);
  echo "<font color=#c0c0c0>$xqfile_time[0]</font><br>";
  echo "</td>\n";
echo "</tr>\n";
   }
  }

echo "</table></center>\n";
//////////////////////////////
echo "<table border=1 cellpadding=3 cellspacing=0 style='border-collapse:collapse' bordercolor=$main_color width=100%>\n";
echo "<tr>\n";
echo "<td width=100% align=right >\n";
page_menu($totalnum);
echo "</td>\n";
echo "</tr>\n";
echo "</table><br>\n";
//////////////////////////////////////////////////////////////////////
echo "<a href=\"usermail.php\" ><img border=0 src=./images/email.gif> 订阅文章 </a>";
echo "<a href=\"userput.php\" ><img border=0 src=./images/mail.gif> 提交文章 </a>";
echo "<a href=\"usersent.php\" ><img border=0 src=./images/top.gif> 注册用户</a>";
echo "<td width=40% valign=top>\n";

/////////////////////////////推荐文章//////////////////////////
echo "<table border=0 bgcolor=\"$main_color\" cellspacing=1 cellpadding=1 width=100%>\n";
echo "<tr>\n";
echo "<td width=100% bgcolor=$main_color>\n";
echo "<img src='../images/subscribe.gif' width=16 heigth=16> 推荐文章\n";
echo "</td>\n";
echo "</tr>\n";
$type_each_count=count($type_list)-1;
for ($i=0;$i<=$type_each_count;$i++){
$filelist_array11=file("data/$type_list[$i].tui");
     $type_each_count11=count($filelist_array11)-1;
     for ($j=0;$j<=$type_each_count11;$j++){
     $filelist_name11=explode("|",$filelist_array11[$j]);
     $filelist_array22[$filelist_array11[$j]]=$filelist_name11[0];
     }
  }
$file_tui_count=count($filelist_array22)-1;
@asort($filelist_array22);
@reset($filelist_array22);
for ($counter=0; $counter<=$file_tui_count; $counter++) {
    $file_tui_sort[]=key($filelist_array22);
    if (!(next($filelist_array22))) break;
    }

for ($i=$file_tui_count;$i>=$file_tui_count-$page_list_new+1;$i--) {
        $file_tui_name=explode("|",$file_tui_sort[$i]);
    if ( "$file_tui_name[0]" && "$file_tui_name[0]" != '.' && "$file_tui_name[0]" != '..') {
  $file_tui_array=file("data/$file_tui_name[1]/$file_tui_name[0].num");
  $file_tui_info=explode("|",$file_tui_array[0]);
     $len = strlen($file_tui_info[1]);
  if ($len <= $new_hot_code)
     $title = $file_tui_info[1];
  else
    $title =substr($file_tui_info[1],0,$new_hot_code)."...";
echo "<tr><td align=left bgcolor=\"white\" onmouseover=\"this.bgColor='$fuse_color';\" onmouseout=\"this.bgColor='white';\">";
echo "<img src=./images/dot1.gif>&nbsp;<a target=_blank href=show.php?type=$file_tui_name[1]&id=$file_tui_info[0]>$title</a>\n";
if (empty($file_tui_info[2]))
$file_tui_info[2]="未知";
echo "<font color=#c0c0c0>文:$file_tui_info[2]</font>";
echo "<br>";
echo "</td>\n";
echo "</tr>\n";
 }
}
echo "</table><br>\n";
/////////////////////////////////////// 本类最新文章////////////////////
$type_each_count=count($type_list)-1;
for ($i=0;$i<=$type_each_count;$i++){
$filelist_array11=file("data/$type_list[$i].new");
     $type_each_count11=count($filelist_array11)-1;
     for ($j=0;$j<=$type_each_count11;$j++){
     $filelist_name11=explode("|",$filelist_array11[$j]);
     $filelist_array22[$filelist_array11[$j]]=$filelist_name11[0];
     }
  }
$file_new_count=count($filelist_array22)-1;
@asort($filelist_array22);
@reset($filelist_array22);
for ($counter=0; $counter<=$file_new_count; $counter++) {
    $file_new_sort[]=key($filelist_array22);
    if (!(next($filelist_array22))) break;
    }
echo "<table border=0 bgcolor=\"$main_color\" cellspacing=1 cellpadding=1 width=100%>\n";
echo "<tr>\n";
echo "<td width=100% bgcolor=$main_color>\n";
echo "<img src='../images/subscribe.gif' width=16 heigth=16> 本类最新文章\n";
echo "</td>\n";
echo "</tr>\n";
for ($i=$file_new_count+1;$i>=$file_new_count-$page_list_new+1;$i--) {
        $file_new_name=explode("|",$file_new_sort[$i]);
    if ( "$file_new_name[0]" && "$file_new_name[0]" != '.' && "$file_new_name[0]" != '..') {
  $file_new_array=file("data/$file_new_name[1]/$file_new_name[0].num");
  $file_new_info=explode("|",$file_new_array[0]);

     $len = strlen($file_new_info[1]);
  if ($len <= $new_hot_code)
     $title = $file_new_info[1];
  else
    $title =substr($file_new_info[1],0,$new_hot_code)."...";
echo "<tr><td align=left bgcolor=\"white\" onmouseover=\"this.bgColor='$fuse_color';\" onmouseout=\"this.bgColor='white';\">";
echo "<img src=./images/dot1.gif>&nbsp;<a target=_blank href=show.php?type=$file_new_name[1]&id=$file_new_info[0]>$title</a>\n";
$file_time=explode(" ",$file_new_info[6]);
echo "<font color=#c0c0c0>-$file_time[0]</font>";
echo "<br>";
echo "</td>\n";
echo "</tr>\n";
 }
}
echo "</table>\n";

echo "<br>\n";

/////////////////////////////// 本类热门文章
for ($i=0;$i<=$type_each_count;$i++){
$filelist_array111=file("data/$type_list[$i].hot");
     $type_each_count111=count($filelist_array111)-1;
     for ($j=0;$j<=$type_each_count111;$j++){
     $filelist_name111=explode("|",$filelist_array111[$j]);
     $filelist_array222[$filelist_array111[$j]]=$filelist_name111[2];  }
  }
@asort($filelist_array222);
$file_hot_count=count($filelist_array222)-1;

for ($counter=0; $counter<=$file_new_count; $counter++) {
    $file_hot_sort[]=key($filelist_array222);
    if (!(next($filelist_array222))) break;
    }
echo "<table border=0 bgcolor=\"$main_color\" cellspacing=1 cellpadding=1 width=100%>\n";
echo "<tr>\n";
echo "<td width=100% bgcolor=$main_color>\n";
echo "<img src='../images/subscribe.gif' width=16 heigth=16> 本类热门文章\n";
echo "</td>\n";
echo "</tr>\n";
for ($i=$file_hot_count;$i>=$file_hot_count-$page_list_new+1;$i--) {
        $file_hot_name=explode("|",$file_hot_sort[$i]);
    if ( "$file_hot_name[0]" && "$file_hot_name[0]" != '.' && "$file_hot_name[0]" != '..') {
  $file_hot_array=file("data/$file_hot_name[1]/$file_hot_name[0].num");
  $file_hot_info=explode("|",$file_hot_array[0]);

     $len = strlen($file_hot_info[1]);
  if ($len <= $new_hot_code)
     $title = $file_hot_info[1];
  else
    $title =substr($file_hot_info[1],0,$new_hot_code)."...";
echo "<tr><td align=left bgcolor=\"white\" onmouseover=\"this.bgColor='$fuse_color';\" onmouseout=\"this.bgColor='white';\">";
echo "<img src=./images/dot1.gif>&nbsp;<a target=_blank href=show.php?type=$file_hot_name[1]&id=$file_hot_info[0]>$title</a>\n";
echo "<font color=#c0c0c0>阅:</font><font color=red>$file_hot_info[16]/$file_hot_info[17]</font>";
echo " <font color=#c0c0c0>评:$file_hot_info[18]</font>";
echo "<br>";
echo "</td>\n";
echo "</tr>\n";
 }
}
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";

echo "</td>\n";
echo "</tr>\n";
echo "<TR > <TD  colspan='2' vAlign=top width='100%'><P align=right class=small><A href='http://shcj.51.net'><FONTcolor=#000000>Powered by XqArt 1.08</FONT></A></P></TD></TR></TBODY></TABLE></DIV></TD></TR>";
echo "</table>\n";
require("foot.php");
?>