⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 category.php

📁 软件类别: PHP源码 / 文章管理 软件语言: 简体中文 授权方式: 商业版 文件大小: 308K
💻 PHP
📖 第 1 页 / 共 2 页
字号:
  if (($name == "") | ($displayorder == "")) {    adminerror("栏目空白","所有栏目必须全部填写,只有标记 <span class=\"red\">(可选)</span> 的栏目可以留空");  }  verifyid("news_category",$id);  verifyid("news_theme",$defaulttheme);  settype($parentid,"integer");  $level = 1;  if ($parentid) {    $data_arr = query_first("SELECT id,parentid FROM news_category WHERE id = $parentid");    if (!$data_arr) {      adminerror("无效ID","你指定了一个无效id.");    }    $level ++;    if ($data_arr[parentid] != 0) {      $level ++;    }  }  $old_data = query_first("SELECT children,parentid,name FROM news_category WHERE id = $id");  if ($old_data[parentid] != $parentid) {    $getsub = query("SELECT id,children FROM news_category WHERE parentid = $id");    if (countrows($getsub)) {      $level ++;    }    while ($sub_arr = fetch_array($getsub)) {      if ($parentid == $sub_arr[id]) {        adminerror("Invalid Parent","You have specified that you wish to make this category a child to a category which is a child to itself, you cannot do this.");      } elseif ($sub_arr[children]) {        $bot_ids .= iif($bot_ids,",'$sub_arr[id]'","'$sub_arr[id]'");      }    }    if ($bot_ids) {      $getbot = query("SELECT id FROM news_category WHERE parentid IN ($bot_ids)");      while ($bot_arr = fetch_array($getbot)) {        if ($parentid == $bot_arr[id]) {          adminerror("Invalid Parent","You have specified that you wish to make this category a child to a category which is a child to itself, you cannot do this.");        }      }      $level ++;    }    if ($level > 3) {      adminerror("分类移动错误","By moving this category to the one you specified it will result in a category that is more than 3 levels deep, the files module only supports 3 levels of categories and you cannot continue.  Please check that the category you are moving does not have any sub categories.");    }    query("UPDATE news_category SET children = children-'1' WHERE id = $old_data[parentid]");    query("UPDATE news_category SET children = children+'1' WHERE id = $parentid");    if (($old_data[parentid] == 0) & ($parentid != 0)) {      query("ALTER TABLE news_staff DROP canpost_$id");      query("OPTIMIZE TABLE news_staff");    } elseif (($old_data[parentid] > 0) & ($parentid == 0)) {      query("ALTER TABLE news_staff ADD canpost_$id TINYINT(1) DEFAULT '0' NOT NULL");      query("OPTIMIZE TABLE news_staff");    }  }  query("UPDATE news_page SET description = 'This page is the menu for the category called <b>$name</b>.' WHERE title = 'menu_$id'");  unset($recentpost_temp);  foreach ($cat_arr AS $key => $val) {    $recentpost_temp .= iif($recentpost[$key],iif($recentpost_temp,",$key",$key),"");  }  query("UPDATE news_category SET    parentid = '$parentid',    name = '$name',    description = '$content',    image = '$image',    allowcomments = '$allowcomments',    allowview = '$allowview',    showsitestats = '$showsitestats',    showforumstats = '$showforumstats',    showforumoptions = '$showforumoptions',    showpoll = '$showpoll',    showannouncement = '$showannouncement',    showsubcats = '$showsubcats',    defaulttheme = '$defaulttheme',    forcetheme = '$forcetheme',    recentpost = '$recentpost_temp',    display = '$display',    displayorder = '$displayorder',    displaymain = '$displaymain'    WHERE id = $id");  unset($cat_arr);  $cat_arr = getcat_arr();  writeallpages();  if ($parentid) {    if ($data_arr[parentid]) {      $expandurl = "&expand=$data_arr[parentid]&subexpand=$parentid".iif($old_data[children],"&botexpand=$id","");    } else {      $expandurl = "&expand=$parentid".iif($old_data[children],"&subexpand=$id","");    }  } else {    $expandurl = iif($old_data[children],"&expand=$id","");  }  echoadminredirect("admin.php?action=category$expandurl");break;case "category_delete":  verifyid("news_category",$id);  if (($defaultcat_loggedout == $id) | ($defaultcat_loggedin == $id) | ($defaultcat_staff == $id)) {    adminerror("不能删除分类","你不能删除这个设置为默认分类的分类, 你必须改变设置才能继续");  }  echodeleteconfirm("新闻分类","category_kill",$id,"注意这将删除所有关联到这个分类的新闻主题和评论");break;case "category_kill":  settype($id,"integer");  if ($data_arr = query_first("SELECT id,children,parentid FROM news_category WHERE id = $id")) {    unset($news_ids);    unset($staff_ids);    unset($user_ids);    unset($cat_ids);    $cat_ids[] = $id;    if ($data_arr[children]) {      $getmid = query("SELECT id,children FROM news_category WHERE parentid = $id");      while ($mid_arr = fetch_array($getmid)) {        if ($mid_arr[children]) {          $getbot = query("SELECT id FROM news_category WHERE parentid = $mid_arr[id]");          while ($bot_arr = fetch_array($getbot)) {            $cat_ids[] = $bot_arr[id];          }        }        $cat_ids[] = $mid_arr[id];      }    }    foreach ($cat_ids AS $val) {      if (($defaultcat_loggedout == $val) | ($defaultcat_loggedin == $val) | ($defaultcat_staff == $val)) {        adminerror("不能删除分类","You cannot delete this category as this category itself, or one below it, is set to the default category, you must first alter this to continue");      }    }    $cat_list = join("','",$cat_ids);    $getposts = query("SELECT id,staffid FROM news_news WHERE catid IN ('$cat_list')");    while ($news_data = fetch_array($getposts)) {      $staff_ids[$news_data[staffid]] ++;      $news_ids[] = $news_data[id];    }    if ($news_ids) {      $getcomments = query("SELECT userid FROM news_comment WHERE newsid IN (".join(",",$news_ids).")");      while ($comments_data = fetch_array($getcomments)) {        $user_ids[$comments_data[userid]] ++;      }      if ($user_ids) {        foreach($user_ids AS $key => $val) {          query("UPDATE $foruminfo[user_table] SET $foruminfo[posts_field] = $foruminfo[posts_field] -'$val' WHERE $foruminfo[userid_field] = $val");        }      }      foreach($staff_ids AS $key => $val) {        query("UPDATE news_staff SET newsposts = newsposts-'$val' WHERE id = $val");      }      query("DELETE FROM news_news WHERE catid IN ('$cat_list')");      query("DELETE FROM news_comment WHERE newsid IN (".join(",",$news_ids).")");    }    query("DELETE FROM news_category WHERE id IN ('$cat_list')");    query("DELETE FROM news_announcement WHERE catid IN ('$cat_list')");    if ($data_arr[parentid] == 0) {      query("ALTER TABLE news_staff DROP canpost_$id");      query("OPTIMIZE TABLE news_staff");    }    $getpolls = query("SELECT display,id FROM news_poll");    while ($poll_data = fetch_array($getpolls)) {      $new_data = $poll_data[display];      foreach ($cat_ids AS $val) {        $new_data = str_replace("$val,","",$new_data);        $new_data = str_replace(",$val,","",$new_data);        $new_data = str_replace(",$val","",$new_data);      }      if ($new_sitecategory != $poll_data[display]) {        query("UPDATE news_poll SET display = '$new_data' WHERE id = $poll_data[id]");      }    }    $getcategories = query("SELECT recentpost,id FROM news_category");    while ($category_data = fetch_array($getcategories)) {      $new_data = $category_data[recentpost];      foreach ($cat_ids AS $val) {        $new_data = str_replace("$val,","",$new_data);        $new_data = str_replace(",$val,","",$new_data);        $new_data = str_replace(",$val","",$new_data);      }      if ($new_data != $category_data[recentpost]) {        query("UPDATE news_category SET recentpost = '$new_data' WHERE id = $category_data[id]");      }    }    $gettempsets = query("SELECT id FROM news_pageset");    foreach ($cat_ids AS $val) {      query("DELETE FROM news_page WHERE title = 'menu_$val'");      @unlink("pages/default/menu_".$val.".vnp");      data_seek($gettempsets,0);      while ($set_arr = fetch_array($gettempsets)) {        @unlink("static/index/index_$val"."_".$set_arr[id].".php");        @unlink("static/comment/comment_$val"."_".$set_arr[id].".php");        @unlink("static/polls/options_$val"."_".$set_arr[id].".php");        @unlink("static/polls/results_$val"."_".$set_arr[id].".php");        @unlink("pages/user/menu_$val"."_".$set_arr[id].".vnp");      }    }    if ($data_arr[parentid]) {      query("UPDATE news_category SET children = children-'1' WHERE id = $data_arr[parentid]");      $temp = query_first("SELECT parentid FROM news_category WHERE id = $data_arr[parentid]");      if ($temp[parentid]) {        $expandurl = "&expand=$temp[parentid]&subexpand=$data_arr[parentid]";      } else {        $expandurl = "&expand=$data_arr[parentid]";      }    }    unset($cat_arr[$id]);    writeallpages();    echoadminredirect("admin.php?action=category$expandurl");  } else {    adminerror("无效ID","你指定了一个无效id.");  }break;case "category_ann_edit":  settype($catid,"integer");  if ($data_arr = query_first("SELECT content,image,link FROM news_announcement WHERE catid = $catid LIMIT 1")) {    echohtmlheader("qhtmlcode");    echoformheader("category_ann_update","编辑公告");    updatehiddenvar("catid",$catid);    echotabledescription("通过这个页面编辑分类公告,并显示如下:");    echotablerow("分类名称:",$cat_arr[$catid][name]);    echoinputcode("图片:","image",$data_arr[image],40,1);    echoinputcode("图片连接:","imagelink",$data_arr[link],40,1);    if ($staff_allowqhtml) {      echoqhtmlhelp();    }    echotextareacode("当前公告:","content",$data_arr[content],10,100,1);    echoformfooter();    echohtmlfooter();  } else {    adminerror("无效ID","你指定了一个无效id.");  }break;case "category_ann_update":  verifyid("news_category",$catid);  query("UPDATE news_announcement SET content = '$content' , image = '$image' , link = '$imagelink' WHERE catid = $catid");  writeallpages();  echoadminredirect("admin.php?action=category");  exit;break;default:  adminerror("无效连接","你跳转到一个无效的连接");}/*======================================================================*\|| ####################################################################|| # VirtuaNews is not free software|| # Downloaded: [WDYL-WTN]|| # File: admin/category.php|| ####################################################################\*======================================================================*/?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -