插件代码上传
This commit is contained in:
		
							
								
								
									
										25
									
								
								plugin/404/include.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								plugin/404/include.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<?php
 | 
			
		||||
function zxd_ctrlcenter_404(){
 | 
			
		||||
    global $zbp;
 | 
			
		||||
    if(!$zbp->Config('zxd_ctrlcenter')->plugin_404_Enable)
 | 
			
		||||
        return false;
 | 
			
		||||
        
 | 
			
		||||
    if (!in_array("Status: 404 Not Found", headers_list())) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    $url = $zbp->Config('zxd_ctrlcenter')->plugin_404_redirect_url;
 | 
			
		||||
    
 | 
			
		||||
    $delay = $zbp->Config('zxd_ctrlcenter')->delay ?: 0;
 | 
			
		||||
    if ($url && preg_match("/^http[s]?:\/\/.+\.\w+/", $url)){
 | 
			
		||||
        // 采用 js 跳转兼容性好
 | 
			
		||||
        if ($delay==0 && function_exists("RedirectByScript")) {
 | 
			
		||||
            RedirectByScript($url);
 | 
			
		||||
        }else{
 | 
			
		||||
            // 采用 html
 | 
			
		||||
            echo '<meta http-equiv="refresh" content="0;url=' . $url . '">';
 | 
			
		||||
            die();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								plugin/404/logo.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								plugin/404/logo.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 9.1 KiB  | 
							
								
								
									
										68
									
								
								plugin/404/main.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								plugin/404/main.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
<?php
 | 
			
		||||
$redirect_url = GetVars('redirect_url', 'POST');
 | 
			
		||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 | 
			
		||||
    if ($redirect_url != "" && !preg_match("/^http[s]{0,1}:\/\/.+\.\w+/", $redirect_url)) {
 | 
			
		||||
        $zbp->ShowHint('bad', '自定义 Url 不正确');
 | 
			
		||||
    } else {
 | 
			
		||||
        $zbp->Config('zxd_ctrlcenter')-> plugin_404_redirect_url = $redirect_url;
 | 
			
		||||
        $zbp->SaveConfig('zxd_ctrlcenter');
 | 
			
		||||
        $zbp->ShowHint('good');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
    <!--代码-->
 | 
			
		||||
    <div class="content-box-content">
 | 
			
		||||
        <!--收录设置-->
 | 
			
		||||
        <div id="tab-fetch" class="tab-content default-tab"
 | 
			
		||||
            style="border:none;padding:0px;margin:0;">
 | 
			
		||||
            <div style="clear:both;"></div>
 | 
			
		||||
            <form name="Thx_auto_link_fetch" method="post">
 | 
			
		||||
                <?php if (function_exists('CheckIsRefererValid')) {
 | 
			
		||||
                    echo '<input type="hidden" name="csrfToken" value="' . $zbp->GetCSRFToken() . '">';
 | 
			
		||||
                }
 | 
			
		||||
                ?>
 | 
			
		||||
                <table name='base' style="padding:0px;margin:0px;width:100%;">
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th width="20%">
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <b>配置项</b>
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </th>
 | 
			
		||||
                        <th width="50%">
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <b>设置</b>
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </th>
 | 
			
		||||
                        <th width="30%">
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <b>说明</b>
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </th>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <p align="center">
 | 
			
		||||
                                <b>重定向链接</b>
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <p>
 | 
			
		||||
                                <input type="url" id="redirect_url" name="redirect_url"
 | 
			
		||||
                                value="<?php if ($zbp->Config('zxd_ctrlcenter')->plugin_404_redirect_url) {
 | 
			
		||||
                                    echo $zbp->Config('zxd_ctrlcenter')->plugin_404_redirect_url ?: 0;
 | 
			
		||||
                                }
 | 
			
		||||
                                ?>">
 | 
			
		||||
                            </p>
 | 
			
		||||
                        </td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <span align="center">输入重定向的【完整】链接地址</span>
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                </table>
 | 
			
		||||
                <p></p>
 | 
			
		||||
                <input type="submit" class="button" value="<?php echo $lang['msg']['submit'] ?>" />
 | 
			
		||||
            </form>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										3
									
								
								plugin/404/manage/config.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								plugin/404/manage/config.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
<?php
 | 
			
		||||
$PluginTitle = "自定义404链接";
 | 
			
		||||
$PluginShortTitle = "404页面";
 | 
			
		||||
							
								
								
									
										34
									
								
								plugin/404/manage/status.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								plugin/404/manage/status.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
<?php
 | 
			
		||||
if(!empty($_GET['include'])&&$_GET['include']=="c_system_base"){
 | 
			
		||||
    // 单独打开时需要引入这个,不然$zbp未定义
 | 
			
		||||
    include_once '../../../../../../zb_system/function/c_system_base.php';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
global $zbp;
 | 
			
		||||
if(empty($_GET['action']))
 | 
			
		||||
    $status_action = "";
 | 
			
		||||
else
 | 
			
		||||
    $status_action = $_GET['action'];
 | 
			
		||||
    
 | 
			
		||||
$Close = '<script>window.close(); window.opener.location.reload(); </script>';
 | 
			
		||||
switch ($status_action) {
 | 
			
		||||
    case 'chk':
 | 
			
		||||
        $pluginstatus = $zbp->Config('zxd_ctrlcenter')-> plugin_404_Enable;
 | 
			
		||||
        break;
 | 
			
		||||
    case 'enb':
 | 
			
		||||
        $zbp->Config('zxd_ctrlcenter')-> plugin_404_Enable = true;
 | 
			
		||||
        $zbp->SaveConfig('zxd_ctrlcenter');
 | 
			
		||||
        echo $Close;
 | 
			
		||||
        break;
 | 
			
		||||
    case 'dis':
 | 
			
		||||
        $zbp->Config('zxd_ctrlcenter')-> plugin_404_Enable = false;
 | 
			
		||||
        $zbp->SaveConfig('zxd_ctrlcenter');
 | 
			
		||||
        echo $Close;
 | 
			
		||||
        break;
 | 
			
		||||
    
 | 
			
		||||
    default:
 | 
			
		||||
        $pluginstatus = $zbp->Config('zxd_ctrlcenter')-> plugin_404_Enable;
 | 
			
		||||
        break;
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
    
 | 
			
		||||
							
								
								
									
										44
									
								
								plugin/404/plugin.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								plugin/404/plugin.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<plugin version="php">
 | 
			
		||||
<id>ThxPage404</id>
 | 
			
		||||
<name>自定义404链接</name>
 | 
			
		||||
<url></url>
 | 
			
		||||
<note>自定义404链接</note>
 | 
			
		||||
<description>当页面出现404时可以自定义跳转链接</description>
 | 
			
		||||
<path>main.php</path>
 | 
			
		||||
<include>include.php</include>
 | 
			
		||||
<level>1</level>
 | 
			
		||||
<author>
 | 
			
		||||
  <name>Thx</name>
 | 
			
		||||
  <email>null@null.com</email>
 | 
			
		||||
  <url>www.izy123.com</url>
 | 
			
		||||
</author>
 | 
			
		||||
<source>
 | 
			
		||||
  <name></name>
 | 
			
		||||
  <email></email>
 | 
			
		||||
  <url></url>
 | 
			
		||||
</source>
 | 
			
		||||
<adapted>151935</adapted>
 | 
			
		||||
<version>1.0</version>
 | 
			
		||||
<pubdate>2019-11-07</pubdate>
 | 
			
		||||
<modified>2020-04-22</modified>
 | 
			
		||||
<price>0</price>
 | 
			
		||||
<phpver>5.6</phpver>
 | 
			
		||||
<advanced>
 | 
			
		||||
  <dependency></dependency>
 | 
			
		||||
  <rewritefunctions></rewritefunctions>
 | 
			
		||||
  <existsfunctions></existsfunctions>
 | 
			
		||||
  <conflict></conflict>
 | 
			
		||||
</advanced>
 | 
			
		||||
<sidebars>
 | 
			
		||||
  <sidebar1></sidebar1>
 | 
			
		||||
  <sidebar2></sidebar2>
 | 
			
		||||
  <sidebar3></sidebar3>
 | 
			
		||||
  <sidebar4></sidebar4>
 | 
			
		||||
  <sidebar5></sidebar5>
 | 
			
		||||
  <sidebar6></sidebar6>
 | 
			
		||||
  <sidebar7></sidebar7>
 | 
			
		||||
  <sidebar8></sidebar8>
 | 
			
		||||
  <sidebar9></sidebar9>
 | 
			
		||||
</sidebars>
 | 
			
		||||
</plugin>
 | 
			
		||||
		Reference in New Issue
	
	Block a user