Example #1
0
function showuserlist($currentpage, $pagesize = 10)
{
    $tempresult = getresult("select count(*) as countofuser from I_user");
    $countofuser = getresultData($tempresult, 0, "countofuser");
    if ($countofuser < 1) {
        echo "<tr class='list'>\n";
        echo "<td colspan='8' align='center'>" . gettext_r("haveNot") . gettext_r("user") . "</td>\n";
        echo "</tr>";
        return;
    }
    $query = "select * from I_user order by id desc limit " . ($currentpage - 1) * $pagesize . "," . "{$pagesize}";
    $result = getresult($query);
    while ($row = getresultArray($result)) {
        echo "<tr class='list'>\n";
        echo "<td> " . $row["id"] . "</td>";
        echo "<td> " . $row["username"] . "</td>";
        echo "<td> " . $row["logintimes"] . "</td>";
        if ($row["iflock"] == 0) {
            echo "<td> <a href=\"javascript:if(confirm('" . gettext_r("ifLockUser") . "'))jump('admin_user.php','lock'," . $row["id"] . ",'iflock',1)\">" . gettext_r("unLock") . "</a></td>";
        } else {
            echo "<td> <a href=\"javascript:if(confirm('" . gettext_r("ifUnLockUser") . "'))jump('admin_user.php','lock'," . $row["id"] . ",'iflock',0)\">" . gettext_r("lock") . "</a></td>";
        }
        //操作权限
        echo "<td align='center'>";
        echo " <a href=\"javascript:jump('admin_user.php','details'," . $row["id"] . ")\">" . gettext_r("see") . gettext_r("details") . "</a> ";
        echo "| <a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_user.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>";
        echo "</td>";
        echo "</tr>\n";
    }
}
Example #2
0
function showpowerlist($adminid = 0)
{
    if ($adminid != 0) {
        $tempresult = getresult("select * from I_admin where id={$adminid}");
        $functioncode = getresultData($tempresult, 0, "functioncode");
        $functionarray = translatefunctioncode($functioncode);
        $result = getresult("select * from I_column where parentid=0");
        while ($row = getresultArray($result)) {
            if ($functionarray[$row["id"]] === "1") {
                echo "<tr>\n";
                echo "<td><input checked=\"true\" type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnname"] . "</td>";
                echo "<td><input checked=\"checked\" type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
                echo "</tr>";
                echo "<tr class='segmentline'><td colspan='2'></td></tr>";
            } elseif ($functionarray[$row["id"]] === "2") {
                echo "<tr>\n";
                echo "<td><input checked=\"true\" type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnname"] . "</td>";
                echo "<td><input type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input checked=\"checked\" type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
                echo "</tr>";
                echo "<tr class='segmentline'><td colspan='2'></td></tr>";
            } else {
                echo "<tr>\n";
                echo "<td><input type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnname"] . "</td>";
                echo "<td><input type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
                echo "</tr>";
                echo "<tr class='segmentline'><td colspan='2'></td></tr>";
            }
        }
        if ($functionarray["vote"] === "1") {
            echo " <tr>";
            echo " <td colspan=\"2\"><input type=\"checkbox\" checked=\"true\" name=\"voteadmin\" value=\"1\" />" . gettext_r("vote") . gettext_r("manage") . "</td>";
            echo "  </tr>";
        } else {
            echo " <tr>";
            echo " <td colspan=\"2\"><input type=\"checkbox\" name=\"voteadmin\" value=\"1\" />" . gettext_r("vote") . gettext_r("manage") . "</td>";
            echo "  </tr>";
        }
        return;
    }
    $result = getresult("select * from I_column where parentid=0");
    while ($row = getresultArray($result)) {
        echo "<tr>\n";
        echo "<td><input type=\"checkbox\" name=\"columnid\" value=\"" . $row["id"] . "\" />" . $row["columnnamezh"] . "</td>";
        echo "<td><input type=\"radio\" name=\"" . $row["id"] . "\" value=\"1\" />" . gettext_r("editer") . "<input type=\"radio\" name=\"" . $row["id"] . "\" value=\"2\" />" . gettext_r("column") . gettext_r("manager") . "</td>";
        echo "</tr>";
        echo "<tr class='segmentline'><td colspan='2'></td></tr>";
    }
    echo " <tr>";
    echo " <td colspan=\"2\"><input type=\"checkbox\" name=\"voteadmin\" value=\"1\" />" . gettext_r("vote") . gettext_r("manage") . "</td>";
    echo "  </tr>";
}
Example #3
0
function showmylabel($currentpage, $pagesize = 10)
{
    $tempresult = getresult("select count(*) as countoflabel from I_mylabel");
    $countoflabel = getresultData($tempresult, 0, "countoflabel");
    if ($countoflabel < 1) {
        echo "<tr class='list'>\n";
        echo "<td colspan='3' align='center'>" . gettext_r("haveNot") . gettext_r("selfDefineTip") . "</td>\n";
        echo "</tr>";
        return;
    }
    $query = "select * from I_mylabel order by id desc limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
    $result = getresult($query);
    while ($row = getresultArray($result)) {
        echo "<tr class='list'>\n";
        echo "<td> " . $row["id"] . "</td>";
        echo "<td> " . $row["labelname"] . "</td>";
        echo "<td align='center'>";
        echo "<a href=\"javascript:jump('admin_mylabel.php','modify'," . $row["id"] . ")\">" . gettext_r("update") . "</a> | <a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_mylabel.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>";
        echo "</td>";
        echo "</tr>\n";
    }
}
Example #4
0
function showtemplatelist($type)
{
    $tempresult = getresult("select count(*) as countoftemplate from I_template where templatetype={$type}");
    $countoftemplate = getresultData($tempresult, 0, "countoftemplate");
    if ($countoftemplate < 1) {
        echo "<tr class='list'>\n";
        echo "<td colspan='4' align='center'>" . gettext_r("haveNot") . gettext_r("template") . "</td>\n";
        echo "</tr>";
        return;
    }
    $query = "select * from I_template where templatetype={$type}";
    $result = getresult($query);
    while ($row = getresultArray($result)) {
        echo "<tr class='list'>\n";
        echo "<td> " . $row["id"] . "</td>";
        echo "<td> " . $row["templatename"] . "</td>";
        echo "<td> " . $row["path"] . "</td>";
        echo "<td align='center'>";
        echo "<a href=\"admin_template.php?type={$type}&action=modify&id=" . $row["id"] . "\">" . gettext_r("update") . "</a> | <a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_template.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>";
        echo "</td>";
        echo "</tr>\n";
    }
}
Example #5
0
 $pwd = getresultData($result, 0, "password");
 $adminrole = getresultData($result, 0, "adminrole");
 if ($_POST["submmit"] == gettext_r("submit")) {
     $adminname = trim($_POST["adminname"]);
     $pwd = md5(trim($_POST["pwd"]));
     if ($_POST["adminrole"] != 1) {
         //是超级管理员
         $query = "update I_admin set adminname='{$adminname}',password='******',adminrole=0 where id={$adminid}";
         getresult($query);
         echo "<script type=\"text/javascript\">alert('" . gettext_r("update") . gettext_r("success") . "');window.location='admin_admin.php';</script>";
         die;
     }
     $result = getresult("select * from I_column where parentid=0");
     $functioncode = "";
     $index = 0;
     while ($row = getresultArray($result)) {
         if ($index == 0) {
             if ($_POST[$row["id"]] != 0) {
                 $functioncode .= $row["id"] . "|" . $_POST[$row["id"]];
                 $index++;
             }
         } else {
             if ($_POST[$row["id"]] != 0) {
                 $functioncode .= "," . $row["id"] . "|" . $_POST[$row["id"]];
             }
         }
     }
     if ($_POST["voteadmin"] == 1) {
         if ($functioncode == "") {
             $functioncode = "vote|1";
         } else {
Example #6
0
function getarticleidlist($columnid)
{
    global $childcolumnString;
    getchildcolumnid_improveed($columnid);
    if ($functionarray[$columnid] === "2" || getlogininfo("adminrole") === "0") {
        $query = "select id from I_article where columnid in ({$childcolumnString})";
    } else {
        $query = "select id from I_article where columnid in ({$childcolumnString}) and adminid=" . getlogininfo("adminid");
    }
    $result = getresult($query);
    if (getresultNumrows($result) < 1) {
        return "-1";
    } else {
        $articleidlist = "";
        while ($row = getresultArray($result)) {
            if ($articleidlist == "") {
                $articleidlist = $row["id"];
            }
            $articleidlist .= "," . $row["id"];
        }
        return $articleidlist;
    }
}
Example #7
0
function translateArticlelist($template)
{
    global $pagesize, $picwidth, $picheight;
    //如果指定页大小,则用用户参数填充$pagesize
    //匹配自定义文章列表标签正则
    $flag = "/【articlelist(\\([\\d\\w]*,\\d*,\\d*,\\d*,\\d*,\\d*,\\d*,\\d*\\))】([\\s\\S]*?)【\\/articlelist】/";
    preg_match_all($flag, $template, $matches, PREG_SET_ORDER);
    //替换所有articlelist标签
    $html = $template;
    //echo $template;
    foreach ($matches as $matche) {
        //得到需要循环的部分
        $str = $matche[2];
        //得到标签参数参数
        $parameter = substr($matche[1], 1, strlen($matche[1]) - 2);
        $parameter = split(',', $parameter);
        $columnid = $parameter[0];
        $articlenum = $parameter[1];
        $titlelen = $parameter[2];
        $ifpage = $parameter[3];
        $timetype = $parameter[4];
        //echo $timetype;
        $sorttype = $parameter[5];
        //缩略图的宽和高
        $picwidth = $parameter[6];
        $picheight = $parameter[7];
        $ifshowpic = "";
        if ($picwidth != null && $picheight != null && $picheight != 0 && $picheight != 0) {
            $ifshowpic = "picurl<>'' and picurl is not NULL and";
        }
        //定义排序方式的字串
        if ($sorttype == "0") {
            //id降序
            $sortstr = "order by id desc";
        } else {
            $sortstr = "order by id asc";
        }
        //如果参数columnid的值为thiscolumn则替换为当前栏目id
        if ($columnid == "columnid" || $columnid == "") {
            $columnid = $_GET["columnid"];
        }
        //栏目子栏目串
        $childColumnString = "";
        getchildcolumnid($columnid, $childColumnString);
        //得到url参数
        $oldpagesize = $pagesize;
        $pagesize = $articlenum;
        $currentpage = $_GET["currentpage"] == NULL || $_GET["currentpage"] <= 0 ? 1 : $_GET["currentpage"];
        //根据参数从数据库取得数据
        if ($ifpage == "1") {
            $articlesql = "select *,left(title,{$titlelen}) as title from I_article where " . $ifshowpic . " columnid in ({$childColumnString}) and ifpass=1 " . $sortstr . " limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
        } else {
            $articlesql = "select *,left(title,{$titlelen}) as title from I_article where " . $ifshowpic . " columnid in ({$childColumnString}) and ifpass=1  " . $sortstr . " limit 0,{$articlenum}";
        }
        //echo $articlesql;
        $result = getresult($articlesql);
        //匹配循环部分的标签
        $tag_flag = "/【#[\\s\\S]*?】/";
        preg_match_all($tag_flag, $str, $data_tag, PREG_SET_ORDER);
        $tag_index = null;
        //记录标签循环部分每中标签出现的次数,如果出现第二次,则视为要显示两列数据,依次类推...
        //将要输出的html代码;
        $temphtml = "";
        while ($row = getresultArray($result)) {
            $str = $matche[2];
            foreach ($data_tag as $temp) {
                //$tempindex = 0;
                for (;;) {
                    if ($tag_index[$temp[0]] < 1) {
                        //初始化一篇文章数据
                        initarticledata($row);
                        //替换标签
                        $str = replace_once($temp[0], $str, getvalue($temp[0], $timetype));
                        //当前匹配标签计数器加1
                        if (isset($tag_index[$temp[0]])) {
                            $tag_index[$temp[0]]++;
                        } else {
                            $tag_index[$temp[0]] = 1;
                        }
                        break;
                    } else {
                        //取新文章数据
                        $row = getresultArray($result);
                        //第二次出现的标签都会引发取得新数据,故产生错误
                        //初始化数据
                        initarticledata($row);
                        //当前匹配标签计数器加1
                        $tag_index = NULL;
                    }
                }
            }
            $tag_index = NULL;
            $temphtml .= $str;
        }
        if (trim($temphtml) == "") {
            $html = str_replace($matche[0], gettext_r("haveNot") . gettext_r("article"), $html);
        } else {
            $html = str_replace($matche[0], $temphtml, $html);
        }
        //echo "||".$ifpage;
        if ($ifpage == 0) {
            $pagesize = $oldpagesize;
        }
    }
    return $html;
}
Example #8
0
    if (getresult($updateconfigsql)) {
        $newLog = new Log();
        $newLog->adminName = $_SESSION["adminname"];
        $newLog->logType = 1;
        $newLog->operateContent = 'update config';
        $newLog->ip = $_SERVER["REMOTE_ADDR"] . "";
        if (!$newLog->Add()) {
            echo "<script type=\"text/javascript\">alert('日志存储错误')</script>";
        }
        echo "<script type='text/javascript'>alert('" . gettext_r("update") . gettext_r("success") . "');window.location=window.location;</script>";
    } else {
        echo "<script type='text/javascript'>alert('" . gettext_r("update") . gettext_r("fail") . "');</script>";
    }
}
$result = getresult("select * from I_siteconfig");
$row = getresultArray($result);
$sitedomain = $row["domain"];
$sitename = $row["sitename"];
//$sitelanguage = $row["sitelanguage"];
$logo = $row["logo"];
$adminemail = $row["adminemail"];
$keywords = $row["keywords"];
$copyright = $row["copyright"];
$indextemplate = $row["indextemplate"];
$adminlang = $row["adminlang"];
$frontlang = $row["frontlang"];
?>
<form id="form1" name="form1" method="post" action="" onsubmit="return siteConfigCheck()">
<table width="100%" cellspacing="0" cellpadding="3" border="1" bordercolor="#FFFFFF" style="border-collapse:collapse">
   <tr>
    <td class='label'><?php 
Example #9
0
function showarticle($columnid, $currentpage, $pagesize = 10)
{
    global $childcolumnString, $functionarray;
    getchildcolumnid_improveed($columnid);
    //echo $childcolumnString."haoxuefeng";
    /*if($functionarray[$columnid]==="2"||getlogininfo("adminrole")==="0")
    		$tempresult = getresult("select count(*) as countofarticle from I_article where columnid in (".$childcolumnString.")");
    	else
    		$tempresult = getresult("select count(*) as countofarticle from I_article where columnid in (".$childcolumnString.") and ifpass=0 and adminid=".getlogininfo("adminid"));
    	$countofarticle = getresultData($tempresult, 0, "countofarticle");
    	if($countofarticle<1)
    	{
    		echo "<tr class='list'>\n";
    		echo "<td colspan='8' align='center'>暂无文章</td>\n";
    		echo "</tr>";
    		return;
    	}*/
    //echo $countofarticle."|";
    //分页显示
    if ($functionarray[$columnid] === "2" || getlogininfo("adminrole") === "0") {
        $query = "select * from I_article where columnid in (" . $childcolumnString . ") order by id desc limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
    } else {
        $query = "select * from I_article where columnid in (" . $childcolumnString . ") and ifpass=0 and adminid=" . getlogininfo("adminid") . " order by id desc limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
    }
    //echo $query;
    $result = getresult($query);
    if ($currentpage > 1 && getresultNumrows($result) < 1) {
        //echo $currentpage;
        echo "<script type=\"text/javascript\">window.location='admin_article.php?columnid={$columnid}&currentpage=" . ($currentpage - 1) . "'</script>";
        return;
    } else {
        if ($currentpage <= 1 && getresultNumrows($result) < 1) {
            echo "<tr class='list'>\n";
            echo "<td colspan='8' align='center'>" . gettext_r("haveNot") . gettext_r("article") . "</td>\n";
            echo "</tr>";
            return;
        }
    }
    while ($row = getresultArray($result)) {
        echo "<tr class='list'>\n";
        echo "<td align='center'><input type='checkbox' name='list' value='" . $row["id"] . "' /></td>";
        echo "<td> " . $row["id"] . "</td>";
        echo "<td> " . getcolumnformation($row["id"], "columnname") . "</td>";
        echo "<td> " . $row["title"] . "</td>";
        echo "<td> " . $row["author"] . "</td>";
        echo "<td> " . $row["hits"] . "</td>";
        if ($functionarray[$columnid] === "2" || getlogininfo("adminrole") === "0") {
            if ($row["ifpass"] == 1) {
                echo "<td> <a href='javascript:passarticle(" . $row["id"] . ",0)'>" . gettext_r("havePass") . "</a></td>";
            } else {
                echo "<td> <a href='javascript:passarticle(" . $row["id"] . ",1)'>" . gettext_r("notPass") . "</a></td>";
            }
        } else {
            if ($row["ifpass"] == 1) {
                echo "<td> " . gettext_r("havePass") . "</td>";
            } else {
                echo "<td> " . gettext_r("notPass") . "</td>";
            }
        }
        //操作权限
        echo "<td>";
        echo " <a href=\"javascript:jump('admin_article.php','modify'," . $row["id"] . ",'columnid',{$columnid})\">" . gettext_r("update") . "</a> ";
        echo "| <a href=\"javascript:if(confirm('" . gettext_r("ifDelete") . "'))jump('admin_article.php','delete'," . $row["id"] . ")\">" . gettext_r("delete") . "</a>";
        echo "</td>";
        echo "</tr>\n";
    }
}
Example #10
0
function translateSearchlist($template)
{
    global $pagesize;
    //如果指定页大小,则用用户参数填充$pagesize
    //匹配自定义文章列表标签正则
    $flag = "/【searchlist(\\(\\d*,\\d*,\\d*,\\d*\\))】([\\s\\S]*?)【\\/searchlist】/";
    preg_match_all($flag, $template, $matches, PREG_SET_ORDER);
    //替换所有articlelist标签
    $html = $template;
    //echo $template;
    foreach ($matches as $matche) {
        //得到需要循环的部分
        $str = $matche[2];
        //得到标签参数参数
        $parameter = substr($matche[1], 1, strlen($matche[1]) - 2);
        $parameter = split(',', $parameter);
        $articlenum = $parameter[0];
        $titlelen = $parameter[1];
        $timetype = $parameter[2];
        $sorttype = $parameter[3];
        //定义排序方式的字串
        if ($sorttype == "0") {
            //id降序
            $sortstr = "order by id desc";
        } else {
            $sortstr = "order by id asc";
        }
        //得到url参数
        $pagesize = $articlenum;
        //($_GET["pagesize"]==NULL || $_GET["pagesize"]<=0)?10:$_GET["pagesize"];
        $currentpage = $_GET["currentpage"] == NULL || $_GET["currentpage"] <= 0 ? 1 : $_GET["currentpage"];
        //根据参数从数据库取得数据
        $searchSql = "select *,left(title,{$titlelen}) as title from I_article where ifpass=1";
        if ($_GET["title"] != NULL && $_GET["title"] != "") {
            $searchSql .= " and title like '%" . $_GET["title"] . "%'";
        }
        if ($_GET["columnid"] != NULL && $_GET["columnid"] > 0) {
            $sdef_fields = getresult("select * from I_field where columnid=" . getChanelidByColumnid($_GET["columnid"]));
            while ($row = getresultarray($sdef_fields)) {
                if ($_GET[$row["fieldname"]] == NULL || $_GET[$row["fieldname"]] == "") {
                    continue;
                }
                if ($row["datatype"] == "double") {
                    $searchSql .= " and " . $row["fieldname"] . " " . $_GET[$row["fieldname"] . "ctype"] . $_GET[$row["fieldname"]];
                    //echo $_GET[$row["fieldname"]."ctype"]."测试";
                } else {
                    $searchSql .= " and " . $row["fieldname"] . " like '" . $_GET[$row["fieldname"]] . "'";
                }
            }
            //在所有子栏目中搜索
            $childcolumnStr = "";
            getchildcolumnid($_GET["columnid"], $childcolumnStr);
            $searchSql .= " and columnid in (" . $childcolumnStr . ")";
            //echo "Iron".$searchSql;
        }
        $searchSql .= " " . $sortstr . " limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
        //echo $searchSql;
        $result = getresult($searchSql);
        //匹配循环部分的标签
        $tag_flag = "/【#[\\s\\S]*?】/";
        preg_match_all($tag_flag, $str, $data_tag, PREG_SET_ORDER);
        $tag_index = null;
        //记录标签循环部分每中标签出现的次数,如果出现第二次,则视为要显示两列数据,依次类推...
        //将要输出的html代码;
        $temphtml = "";
        while ($row = getresultArray($result)) {
            $str = $matche[2];
            foreach ($data_tag as $temp) {
                //$tempindex = 0;
                for (;;) {
                    if ($tag_index[$temp[0]] < 1) {
                        //初始化一篇文章数据
                        initarticledata($row);
                        //替换标签
                        $str = replace_once($temp[0], $str, getvalue($temp[0], $timetype));
                        //当前匹配标签计数器加1
                        if (isset($tag_index[$temp[0]])) {
                            $tag_index[$temp[0]]++;
                        } else {
                            $tag_index[$temp[0]] = 1;
                        }
                        break;
                    } else {
                        //取新文章数据
                        $row = getresultArray($result);
                        //第二次出现的标签都会引发取得新数据,故产生错误
                        //初始化数据
                        initarticledata($row);
                        //当前匹配标签计数器加1
                        $tag_index = NULL;
                    }
                }
            }
            $tag_index = NULL;
            $temphtml .= $str;
        }
        //echo $matche[0]."<br>";//.$temphtml;
        if (trim($temphtml) == "") {
            $html = str_replace($matche[0], gettext_r("haveNot") . gettext_r("search") . gettext_r("result"), $html);
        } else {
            $html = str_replace($matche[0], $temphtml, $html);
        }
    }
    //显示搜索表单
    $html = str_replace("【#searchform】", getsearchform(), $html);
    //显示分页
    $html = str_replace("【#showpage】", getsearchPage($pagesize), $html);
    return $html;
}
Example #11
0
function showletersearch($firstletter, $currentpage, $pagesize = 10)
{
    echo "<table width='100%' cellpadding='0' cellspacing='0' border='0' style='font-size:12px;'>";
    $tempresult = getresult("select count(*) as countofarticle from I_article where left(title,1)='" . $firstletter . "' and ifpass=1");
    //echo $tempresult;
    $countofarticle = getresultData($tempresult, 0, "countofarticle");
    if ($countofarticle < 1) {
        echo "<tr class='list'>\n";
        echo "<td align='center'>No article</td>\n";
        echo "</tr>";
        echo "</table>";
        return;
    }
    //echo $countofarticle."|";
    //分页显示
    $query = "select * from I_article where left(title,1)='" . $firstletter . "' and ifpass=1  order by id desc  limit " . ($currentpage - 1) * $pagesize . ",{$pagesize}";
    //echo $query;
    $result = getresult($query);
    if (getresultNumrows($result) < 1) {
        return;
    }
    echo "<tr class='articlesegline'>\n";
    echo "<td colspan='3'></td>";
    echo "</tr>";
    while ($row = getresultArray($result)) {
        echo "<tr class='list'>\n";
        echo "<td><a href=\"javascript:parent.location='showarticle.php?articleid=" . $row["id"] . "'\";')\">" . $row["title"] . "</a></td>";
        echo "<td width='60'>" . $row["author"] . "</td>";
        echo "<td width='150' align='right'>" . $row["addtime"] . "</td>";
        echo "</tr>";
        echo "<tr class='articlesegline'>\n";
        echo "<td colspan='3'></td>";
        echo "</tr>";
    }
    echo "</table>";
    //分页
    echo "<div class='showpage'>";
    if ($countofarticle % $pagesize == 0) {
        $allpage = $countofarticle / $pagesize;
    } else {
        $allpage = floor($countofarticle / $pagesize) + 1;
    }
    //消除文章数为零时显示下一页链接的bug
    if ($countofarticle == 0) {
        $allpage += 1;
    }
    //echo $countofarticle%$pagesize." ".$currentpage;
    echo "<b> " . $allpage . " </b> Pages&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    if ($currentpage == 1) {
        echo "First | pre | ";
    } else {
        echo "<a href='articlelist.php?firstletter={$firstletter}&currentpage=1'>First</a> | <a href='articlelist.php?firstletter={$firstletter}&currentpage=" . ($currentpage - 1) . "'>Pre</a> | ";
    }
    $temppage = 1;
    if ($currentpage - 1 < 5) {
        while ($temppage <= $currentpage) {
            if ($currentpage == $temppage) {
                echo "<b>" . $temppage . "</b> ";
                $temppage++;
                continue;
            }
            echo "<a href='articlelist.php?firstletter={$firstletter}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    } else {
        while ($temppage <= $currentpage) {
            if ($currentpage == $temppage) {
                echo "<b>" . $temppage . "</b> ";
                $temppage++;
                continue;
            }
            if ($temppage == 1) {
                echo "<a href='articlelist.php?firstletter={$firstletter}&currentpage={$temppage}'>" . $temppage . "</a> … ";
                $temppage++;
                continue;
            }
            if ($currentpage - $temppage > 3) {
                $temppage++;
                continue;
            }
            echo "<a href='articlelist.php?firstletter={$firstletter}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    }
    if ($allpage - $currentpage < 5) {
        while ($temppage <= $allpage) {
            if ($temppage == 1) {
                echo "<a href='articlelist.php?firstletter={$firstletter}&currentpage={$temppage}'>" . $temppage . "</a> ";
                $temppage++;
                continue;
            }
            echo "<a href='articlelist.php?firstletter={$firstletter}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    } else {
        while ($temppage <= $allpage) {
            if ($temppage == $allpage) {
                echo " … <a href='articlelist.php?firstletter={$firstletter}&currentpage={$temppage}'>" . $temppage . "</a> ";
                $temppage++;
                continue;
            }
            if ($temppage - $currentpage > 3) {
                $temppage++;
                continue;
            }
            echo "<a href='articlelist.php?firstletter={$firstletter}&currentpage={$temppage} '>" . $temppage . "</a> ";
            $temppage++;
        }
    }
    if ($currentpage == $allpage) {
        echo "| Next | Last";
    } else {
        echo "| <a href='articlelist.php?firstletter={$firstletter}&currentpage=" . ($currentpage + 1) . "'>Next</a> | <a href='articlelist.php?firstletter={$firstletter}&currentpage={$allpage}'>Last</a>";
    }
    echo "</div>";
}