forked from muchenkezhan/wordpress-qzdy-themes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
links.php
140 lines (125 loc) · 5.47 KB
/
links.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
/* template name: 页面模板--友情链接自助申请
*/
?>
<?php
if( isset($_POST['blink_form']) && $_POST['blink_form'] == 'send'){
global $wpdb;
// 表单变量初始化
$link_name = isset( $_POST['blink_name'] ) ? trim(htmlspecialchars($_POST['blink_name'], ENT_QUOTES)) : '';
$link_url = isset( $_POST['blink_url'] ) ? trim(htmlspecialchars($_POST['blink_url'], ENT_QUOTES)) : '';
/*$link_description = isset( $_POST['blink_lianxi'] ) ? trim(htmlspecialchars($_POST['blink_lianxi'], ENT_QUOTES)) : ''; // 联系方式*/
$link_description = '图片链接:'.$_POST['blink_image']."\n".'简介:'.$_POST['blink_jianjie'];
$link_target = "_blank";
$link_visible = "N"; // 表示链接默认不可见
// 表单项数据验证
if ( empty($link_name) || mb_strlen($link_name) > 20 ){
wp_die('连接名称必须填写,且长度不得超过30字');
}
if ( empty($link_url) || strlen($link_url) > 60 || !preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $link_url))
//验证url
{
wp_die('链接地址必须填写');
}
$sql_link = $wpdb->insert(
$wpdb->links,
array(
'link_name' => '【待审核】--- '.$link_name,
'link_url' => $link_url,
'link_target' => $link_target,
'link_notes' => $link_description,
'link_visible' => $link_visible
)
);
$result = $wpdb->get_results($sql_link);
wp_die('亲,友情链接提交成功,【等待站长审核中】!<a href="/">点此返回</a>', '提交成功');
}
get_header();
?>
<!--上面是头部-->
<div class="layui-content">
<div class="layui-container">
<div class="layui-row flex <?php qzdy_sidebar_fangxiang(); ?> layui-col-space15 main <?php qzdy_sidebar_fangxiang();?>">
<div class="layui-col-md9 layui-col-lg9">
<!--内容开始-->
<div class="title-article">
<h1><?php the_title(); ?></h1>
<div class="title-msg">
<?php if(!empty($article_author = _qzdy('zero-footer-article-author'))){?>
<span><i class="layui-icon layui-icon-username"></i><?php echo _qzdy('zero-footer-txxnc');?></span><?php } ?>
<span><i class="layui-icon layui-icon-time"></i><?php the_time(' Y/n/j'); ?></span>
<span><i class="fa fa-eye" aria-hidden="true"></i><?php post_views(' ',''); ?>℃</span>
<span><?php edit_post_link('[编辑]'); ?></span>
</div>
</div>
<div class="text" itemprop="articleBody">
<div id="md_content_2" class="md_content markdown-body editormd-html-preview" style="min-height: 50px;">
<div class="content content-link-application">
<div class="form-header">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if(function_exists('cmp_breadcrumbs')) cmp_breadcrumbs();?>
<?php the_content(); ?>
<!--表单开始-->
<form method="post" class="layui-form" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" style="margin-bottom:20px; ">
<label class="layui-form-label" for="blink_name"><font color="red">*</font>链接名称:</label>
<div class="layui-input-block">
<input type="text" size="40" value="" required="required" id="blink_name" placeholder="请输入链接名称" name="blink_name" class="layui-input" />
</div>
<div class="form-group">
<label class="layui-form-label" for="blink_url"><font color="red">*</font>链接地址:</label>
<div class="layui-input-block">
<input type="text" size="40" value="" required="required" class="layui-input" id="blink_url" placeholder="请输入链接,带http://或https://哦!" name="blink_url" />
</div></div>
<div class="form-group">
<label class="layui-form-label" for="blink_jianjie">站点简介:</label>
<div class="layui-input-block">
<input type="text" size="40" value="" class="layui-input" id="blink_jianjie" placeholder="请输入简介" name="blink_jianjie" />
</div></div>
<div class="form-group">
<label class="layui-form-label" required="required" for="blink_image"><font color="red">*</font>站点图标:</label>
<div class="layui-input-block">
<input type="text" size="40" value="" class="layui-input" id="blink_image" placeholder="请输入头像地址" name="blink_image" />
</div></div>
<div class="yqsq-cz-tj">
<input type="hidden" value="send" name="blink_form" />
<button type="submit" class="layui-btn layui-btn-normal">提交申请</button>
<button type="reset" class="layui-btn layui-btn-primary">重填</button>
(提示:带有<font color="red">*</font>,表示必填项~)
</div>
</form>
<!--表单结束-->
<?php endwhile; else: ?>
<?php endif; ?>
</div>
</div>
</div>
<!--底部完毕-->
<div class="the-end">- THE END -</div>
<!--修改日期-->
<div class="time-text">
<i class="layui-icon iconfont iconshijian"></i> 最后修改:<?php the_modified_time('Y年n月j日'); ?></div>
<!--申明-->
<div class="copy-text">
<div>
<p><?php echo _wenzhangbanquan();?></p>
<p class="hidden-xs">如若转载,请注明出处:<a><?php echo get_permalink(); ?></a> </p>
</div>
</div>
</div>
<?php
$zero_footer_plk = _qzdy('zero-footer-plk');
if(!empty($zero_footer_plk)){?>
<?php if (comments_open() ) { ?>
<div class="page-comt<?php echo qzdy_prevent_theme(); ?>">
<?php $file=""; $separate_comments="";?>
<?php comments_template( $file, $separate_comments ); ?>
</div>
<?php } } ?>
</div>
<?php get_sidebar();?>
</div>
</div>
</div>
</div>
<!--底部版权-->
<?php get_footer();?>