Example #1
0
function navcate($id)
{
    global $html;
    $cate = new Category();
    $cate->LoadInfoByID($id);
    $html = '>>  <a href="' . $cate->Url . '" title="查看' . $cate->Name . '中的全部文章">' . $cate->Name . '</a> ' . $html;
    if ($cate->ParentID > 0) {
        navcate($cate->ParentID);
    }
}
Example #2
0
function PostCategory()
{
    global $zbp;
    if (!isset($_POST['ID'])) {
        return;
    }
    if (isset($_POST['Alias'])) {
        $_POST['Alias'] = TransferHTML($_POST['Alias'], '[noscript]');
    }
    $parentid = (int) GetVars('ParentID', 'POST');
    if ($parentid > 0) {
        if ($zbp->categorys[$parentid]->Level > 2) {
            $_POST['ParentID'] = '0';
        }
    }
    $cate = new Category();
    if (GetVars('ID', 'POST') == 0) {
    } else {
        $cate->LoadInfoByID(GetVars('ID', 'POST'));
    }
    foreach ($zbp->datainfo['Category'] as $key => $value) {
        if ($key == 'ID') {
            continue;
        }
        if ($key == 'Meta') {
            continue;
        }
        if (isset($_POST[$key])) {
            $cate->{$key} = GetVars($key, 'POST');
        }
    }
    foreach ($GLOBALS['Filter_Plugin_PostCategory_Core'] as $fpname => &$fpsignal) {
        $fpname($cate);
    }
    FilterCategory($cate);
    FilterMeta($cate);
    CountCategory($cate);
    $cate->Save();
    $zbp->LoadCategorys();
    $zbp->AddBuildModule('catalog');
    if (GetVars('AddNavbar', 'POST') == 0) {
        $zbp->DelItemToNavbar('category', $cate->ID);
    }
    if (GetVars('AddNavbar', 'POST') == 1) {
        $zbp->AddItemToNavbar('category', $cate->ID, $cate->Name, $cate->Url);
    }
    foreach ($GLOBALS['Filter_Plugin_PostCategory_Succeed'] as $fpname => &$fpsignal) {
        $fpname($cate);
    }
    return true;
}