📄 modblacklist.php
字号:
<?php/* <Edit> */function add_magic_quotes($array) { foreach ($array as $k => $v) { if (is_array($v)) { $array[$k] = add_magic_quotes($v); } else { $array[$k] = addslashes($v); } } return $array;}if (!get_magic_quotes_gpc()) { $_GET = add_magic_quotes($_GET); $_POST = add_magic_quotes($_POST); $_COOKIE = add_magic_quotes($_COOKIE);}$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'poststart', 'postend', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder');for ($i=0; $i<count($wpvarstoreset); $i += 1) { $wpvar = $wpvarstoreset[$i]; if (!isset($$wpvar)) { if (empty($_POST["$wpvar"])) { if (empty($_GET["$wpvar"])) { $$wpvar = ''; } else { $$wpvar = $_GET["$wpvar"]; } } else { $$wpvar = $_POST["$wpvar"]; } }}switch($action) { case 'export': require_once('../wp-config.php'); $postquery ="SELECT * FROM {$wpdb->blacklist}"; $exportfile = '导出黑名单'; $results = $wpdb->get_results($postquery); foreach ($results as $result) { $exportfile .=$result->domain."\n"; } //Send the headers to control the download header('Content-Type: text/comma-separated-values'); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Content-Disposition: inline; filename="blacklist.txt"'); echo $exportfile; die(); case 'import': $title = '从文件导入黑名单'; $standalone = 0; require_once ('./admin-header.php'); ?> <div class="wrap"> Import Blacklist Results<br/><br/> <?php $blfilename = $_POST["blfilename"]; $domain = @file($blfilename); if (!$domain) echo "File not found. Please check the path or copy the file to the wp-admin directory."; $answer = ''; for ($i=0; $i<count($domain); $i++) { //echo $domain[$i]."<br/>"; $data = $domain[$i]; $temp = ""; for ($j=0; $j<strlen($data); $j++) { if ($data[$j]==" " || $data[$j] == "#") break; else $temp.=$data[$j]; continue; } //echo $temp."<br/>"; if ($temp!="") { $request = $wpdb->get_row("SELECT id FROM {$wpdb->blacklist} WHERE domain='$temp'"); if (!$request) $request1 = $wpdb->query("INSERT INTO {$wpdb->blacklist} (domain) VALUES ('$temp')"); if (!$request1) $answer = "部分成功"; else $answer = '导入成功!'; } } echo $answer."<br/>"; if ($user_level > 0) { include('blacklistForm.php'); } else { ?> <div class="wrap"> <p>Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to modify the Blacklist.<br /> You can also <a href="mailto:<?php echo $admin_email ?>?subject=Blog posting permission">e-mail the admin</a> to ask for a promotion.<br /> When you’re promoted, just reload this page to play with the Blacklist. :)</p> </div> <?php } break; case 'adddomain': $title = '添加黑名单'; $standalone = 0; require_once ('./admin-header.php'); ?> <div class="wrap"> 添加黑名单<br/><br/> <?php $temp = $_POST["domain"]; $answer = '添加成功!'; $request = $wpdb->get_row("SELECT id FROM {$wpdb->blacklist} WHERE domain='$temp'"); if (!$request) $request = $wpdb->query("INSERT INTO {$wpdb->blacklist} (domain) VALUES ('$temp')"); if (!$request) $answer = "部分成功"; echo $answer."<br/></div>"; if ($user_level > 0) { include('blacklistForm.php'); } else { ?> <div class="wrap"> <p>Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to modify the Blacklist.<br /> You can also <a href="mailto:<?php echo $admin_email ?>?subject=Blog posting permission">e-mail the admin</a> to ask for a promotion.<br /> When you’re promoted, just reload this page to play with the Blacklist. :)</p> </div> <?php } break; default: $title = '黑名单管理'; $standalone = 0; require_once ('./admin-header.php'); if ($user_level > 0) { include('blacklistForm.php'); } else {?><div class="wrap"> <p>Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to modify the Blacklist.<br /> You can also <a href="mailto:<?php echo $admin_email ?>?subject=Blog posting permission">e-mail the admin</a> to ask for a promotion.<br /> When you’re promoted, just reload this page to play with the Blacklist. :)</p></div><?php } break;} // end switch/* </Edit> */include('admin-footer.php');?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -