📄 maintain.php
字号:
echoadminredirect("admin.php?action=maintain"); exit;break;case "maintain_user_c": settype($id,"integer"); if ($temp = query_first("SELECT username FROM news_user WHERE userid = $id")) { echodeleteconfirm("comments","maintain_user_c_kill",$id," This will delete all the comments by the user ".htmlspecialchars($temp[username]),"","prune"); } else { adminerror("无效ID","你指定了一个无效id."); }break;case "maintain_user_c_kill": verifyid($foruminfo[user_table],$id,$foruminfo[userid_field]); $getdata = query("SELECT newsid FROM news_comment WHERE userid = $id"); while ($data_arr = fetch_array($getdata)) { $numcomments[$data_arr[newsid]] ++; } if ($numcomments) { query("DELETE FROM news_comment WHERE userid = $id"); query("UPDATE $foruminfo[user_table] SET $foruminfo[posts_field] = $foruminfo[posts_field] -'".array_sum($numcomments)."' WHERE $foruminfo[userid_field] = $id"); foreach ($numcomments AS $key => $val) { $temp = query_first("SELECT news_comment.userid, news_comment.username AS name, ".$foruminfo[user_table].".".$foruminfo[username_field]." AS username FROM news_comment LEFT JOIN ".$foruminfo[user_table]." ON news_comment.userid = ".$foruminfo[user_table].".".$foruminfo[userid_field]." WHERE (news_comment.newsid = $key) ORDER BY news_comment.time DESC LIMIT 1"); query("UPDATE news_news SET commentcount = commentcount-'$val' , lastcommentuser = '".iif($temp[userid],$temp[username],$temp[name])."' WHERE id = $key"); } } writeallpages(); echoadminredirect("admin.php?action=maintain"); exit;break;case "maintain_news_c": settype($id,"integer"); if ($temp = query_first("SELECT title FROM news_news WHERE id = $id")) { echodeleteconfirm("comments","maintain_news_c_kill",$id," This will delete all the comments for the news post $temp[title] and update the appropriate user post counts..","","prune"); } else { adminerror("无效ID","你指定了一个无效id."); }break;case "maintain_news_c_kill": verifyid("news_news",$id); unset($postcounts); $getdata = query("SELECT userid FROM news_comment WHERE newsid = $id"); while ($data_arr = fetch_array($getdata)) { if ($data_arr[userid]) { $postcounts[$data_arr[userid]] ++; } } query("DELETE FROM news_comment WHERE newsid = $id"); query("UPDATE news_news SET commentcount = '0' , lastcommentuser = '' WHERE id = $id"); if ($postcounts) { foreach ($postcounts AS $key => $val) { query("UPDATE $foruminfo[user_table] SET $foruminfo[posts_field] = $foruminfo[posts_field] -'$val' WHERE $foruminfo[userid_field] = $key"); } } writeallpages(); echoadminredirect("admin.php?action=maintain"); exit;break;case "maintain_news": foreach ($cat_arr AS $key => $val) { $checkboxes .= returncheckboxcode("categories[$key]",1,$val[name]); } echohtmlheader(); echoformheader("maintain_news_kill","删除新闻主题"); echotabledescription("使用这个设置,从数据库中删除过期的你指定的新闻主题和他们的评论"); echotablerow("删除下列分类:","\n$checkboxes "); echoinputcode("删除旧的主题: <span class=\"red\">(天数)</span>","num_days"); echoyesnocode("更新用户发贴数:","updatepostcounts",1); echoformfooter(); echohtmlfooter();break;case "maintain_news_kill": settype($num_days,"integer"); if (!$num_days) { adminerror("无效的日期类型","天数必须是一个有效的整数"); } unset($cat_ids); unset($news_ids); unset($staff_ids); unset($user_ids); unset($cat_posts); foreach ($cat_arr AS $key => $val) { if ($categories[$key]) { $cat_ids[] = $key; } } if ($cat_ids) { $getdata = query("SELECT id,catid,staffid FROM news_news WHERE (time < ".(time()-($num_days*86400)).") AND (catid IN (".join(",",$cat_ids)."))"); while ($data_arr = fetch_array($getdata)) { $news_ids[] = $data_arr[id]; $cat_posts[$data_arr[catid]] ++; if ($updatepostcounts) { $staff_ids[$data_arr[staffid]] ++; $getcomments = query("SELECT COUNT(userid) AS count,userid FROM news_comment WHERE (newsid = $data_arr[id]) AND (userid <> 0) GROUP BY (userid)"); while ($comment_arr = fetch_array($getcomments)) { $user_ids[$comment_arr[userid]] += $comment_arr[count]; } } } } if ($news_ids) { query("DELETE FROM news_news WHERE id IN (".join(",",$news_ids).")"); query("DELETE FROM news_comment WHERE newsid IN (".join(",",$news_ids).")"); foreach ($cat_posts AS $key => $val) { query("UPDATE news_category SET posts = posts-'$val' WHERE id = '$key'"); } if ($staff_ids) { foreach ($staff_ids AS $key => $val) { query("UPDATE news_staff SET newsposts = newsposts-'$val' WHERE id = '$key'"); } } 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] = $key"); } } } writeallpages(); echoadminredirect("admin.php?action=maintain"); exit;break;case "maintain_backup": echohtmlheader("adminjs"); echoformheader("maintain_backup_server","备份服务器数据",2,0,"backup"); echotabledescription("备份数据并保存到服务器的根目录(路径相对于 VirtuaNews 的根目录"); echoinputcode("路径:","path","admin/db_backup_".date("d-m-Y").".sql",60); echoformfooter(2,"备份"); echoformheader("maintain_backup_file","备份文件数据"); echotabledescription("备份数据并保存到你的计算机"); echotabledescription("<b>选择包含备份内容的数据表:</b>"); echotabledescription(returnlinkcode("选择全部","javascript:ca()")." |".returnlinkcode("取消选定","javascript:cn()")); $gettables = query("SHOW TABLES"); while ($table_arr = fetch_array($gettables)) { echoyesnocode("$table_arr[0]:","include[$table_arr[0]]",1,"Yes","No",30); } echoformfooter(2,"备份"); echohtmlfooter();break;case "maintain_backup_server"; if ($path == "") { adminerror("空白区域","所有区域必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } if (function_exists("set_time_limit") == 1) { set_time_limit(1200); } echohtmlheader(); if ($file = @fopen($path,"w")) { @fwrite($file,"# $sitename Database Dump - Powered By VirtuaNews Version $version\n"); @fwrite($file,"# Database Dump At ".date("H:i m-d-Y",time()-$timeoffset)." GMT\n\n"); $gettables = query("SHOW TABLES"); while ($table_arr = fetch_array($gettables)) { @fwrite($file,dumptable($table_arr[0])); echo "Dumping Table: $table_arr[0]<br />\n"; } echo "<br />\n"; echo "数据库正确备份到这个服务器的 $path "; } else { adminerror("写错误","写文件到指定位置发生错误, 请正确设置文件夹权限,确保文件夹可进行写操作."); } @fclose($file); echohtmlfooter();break;case "maintain_backup_file": if (function_exists("set_time_limit") == 1) { set_time_limit(1200); } header("Content-disposition: filename=virtuanews_db.sql"); header("Content-type: unknown/unknown"); echo "# $sitename Database Dump - Powered By VirtuaNews Version $version\n"; echo "# Database Dump At ".date("H:i m-d-Y")." GMT\n\n"; $gettables = query("SHOW TABLES"); while ($table_arr = fetch_array($gettables)) { if ($include[$table_arr[0]]) { echo dumptable($table_arr[0]); } } exit;break;default: adminerror("无效的连接","你跳转到一个无效的连接");}/*======================================================================*\|| ####################################################################|| # VirtuaNews is not free software|| # Downloaded: [WDYL-WTN]|| # File: admin/maintain.php|| ####################################################################\*======================================================================*/?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -