Beispiel #1
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;
    }
}
Beispiel #2
0
function showpage($columnid, $currentpage, $pagesize = 10)
{
    global $childcolumnString, $functionarray;
    getchildcolumnid_improveed($columnid, $childcolumnString);
    //echo $childcolumnString;
    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 % $pagesize == 0) {
        $allpage = $countofarticle / $pagesize;
    } else {
        $allpage = floor($countofarticle / $pagesize) + 1;
    }
    //消除文章数为零时显示下一页链接的bug
    if ($countofarticle == 0) {
        $allpage += 1;
    }
    echo gettext_r("total") . "<b> " . $allpage . " </b>" . gettext_r("page") . "(" . $pagesize . " " . gettext_r("piece") . gettext_r("article") . gettext_r("per") . gettext_r("page") . ") ";
    if ($currentpage == 1) {
        echo gettext_r("firstPage") . " | " . gettext_r("prePage") . " | ";
    } else {
        echo "<a href='admin_article.php?columnid={$columnid}&currentpage=1'>" . gettext_r("firstPage") . "</a> | <a href='admin_article.php?columnid={$columnid}&currentpage=" . ($currentpage - 1) . "'>" . gettext_r("prePage") . "</a> | ";
    }
    $temppage = 1;
    if ($currentpage - 1 < 5) {
        while ($temppage <= $currentpage) {
            if ($currentpage == $temppage) {
                echo "<b>" . $temppage . "</b> ";
                $temppage++;
                continue;
            }
            echo "<a href='admin_article.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    } else {
        while ($temppage <= $currentpage) {
            if ($currentpage == $temppage) {
                echo "<b>" . $temppage . "</b> ";
                $temppage++;
                continue;
            }
            if ($temppage == 1) {
                echo "<a href='admin_article.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> … ";
                $temppage++;
                continue;
            }
            if ($currentpage - $temppage > 3) {
                $temppage++;
                continue;
            }
            echo "<a href='admin_article.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    }
    if ($allpage - $currentpage < 5) {
        while ($temppage <= $allpage) {
            if ($temppage == 1) {
                echo "<a href='admin_article.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
                $temppage++;
                continue;
            }
            echo "<a href='admin_article.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    } else {
        while ($temppage <= $allpage) {
            if ($temppage == $allpage) {
                echo " … <a href='admin_article.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
                $temppage++;
                continue;
            }
            if ($temppage - $currentpage > 3) {
                $temppage++;
                continue;
            }
            echo "<a href='admin_article.php?columnid={$columnid}&currentpage={$temppage}'>" . $temppage . "</a> ";
            $temppage++;
        }
    }
    if ($currentpage == $allpage) {
        echo "| " . gettext_r("nextPage") . " | " . gettext_r("lastPage");
    } else {
        echo "| <a href='admin_article.php?columnid={$columnid}&currentpage=" . ($currentpage + 1) . "'>" . gettext_r("nextPage") . "</a> | <a href='admin_article.php?columnid={$columnid}&currentpage={$allpage}'>" . gettext_r("lastPage") . "</a>";
    }
}