From 38c616cac8dbd7255ff61f8160eff148f4957a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E8=90=BD?= Date: Thu, 13 Feb 2020 08:53:12 +0800 Subject: [PATCH] add --- framework/options-config.php | 6 ++++ functions/Common.php | 29 ++++++++++++++-- functions/func_load.php | 2 +- functions/security.php | 66 +++++++++++++++++++++++++++++++++++- functions/user.php | 9 ++--- public/notify.php | 4 +-- 6 files changed, 103 insertions(+), 13 deletions(-) diff --git a/framework/options-config.php b/framework/options-config.php index 2261794..9aa13c1 100644 --- a/framework/options-config.php +++ b/framework/options-config.php @@ -374,6 +374,12 @@ $gdk_options = [ ], 'std' => '1' ], + [ + 'name' => '友情链接分类ID', + 'desc' => '请选择专门用来存放友链的链接分类ID', + 'id' => 'gdk_link_id', + 'type' => 'number' + ], [ 'name' => 'HTML代码压缩', 'desc' => '启用 【开启后,将压缩网页HTML代码,可读性会降低,但是性能略有提升】', diff --git a/functions/Common.php b/functions/Common.php index 46c30b1..d6c4d05 100644 --- a/functions/Common.php +++ b/functions/Common.php @@ -951,6 +951,30 @@ function gdk_thumbnail_src() { } +/** + * 获取略缩图,输出img标签代码 + * @param [init] $way 缩略图方案代码,1=cdn,2=timthumb,3=aq_resize + * @param [string] $url 缩略图原图链接,调用gdk_thumbnail_src() + * @param [init] $width 缩略图宽度 + * @param [init] $height 缩略图高度 + * @param [string] $style 图片样式,cdn方案时有效 + * @param [string] $atrr img标签的属性 + * @return [string] img标签的图片代码 + */ +function gdk_thumb_img($way,$url,$width,$height,$style,$atrr = 'class="thumb_img"'){ + if ($way === 1) {//cdn + $src = $url.'!'.$style; + }elseif ($way === 2) { + $src = GDK_BASE_URL . '/public/timthumb.php?src='.$url.'&h='.$height.'&w='.$width.'&q=90&zc=1&ct=1'; + }elseif ($way === 3) { + $src = aq_resize( $url, $width , $height , true); + }else{ + return false; + } + echo ''; +} + + //生成订单号编码 function gdk_order_id(){ date_default_timezone_set('Asia/Shanghai'); @@ -1007,7 +1031,7 @@ function gdk_get_the_link_items($id = null) { } function gdk_get_link_items() { - $linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude=7'); + $linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude='.gdk_option('gdk_link_id')); $result = ''; foreach ($linkcats as $linkcat) { $result.= '
@@ -1153,12 +1177,11 @@ function gdk_weauth_token(){ $qr64 = []; $qr64['key'] = gdk_weauth_token(); $qr64['qrcode'] = gdk_http_request('https://wa.isdot.net/qrcode?str='.$qr64['key'])['qrcode']; - // https://api.goauth.jysafe.cn/ + //$qr64['qrcode'] = gdk_http_request('https://api.goauth.jysafe.cn/qrcode?str='.$qr64['key'])['qrcode'];//预备使用,备胎 return $qr64; } - /** * 微信登陆按钮 */ diff --git a/functions/func_load.php b/functions/func_load.php index 1b6239b..358b7b8 100644 --- a/functions/func_load.php +++ b/functions/func_load.php @@ -13,4 +13,4 @@ include( 'user.php' );//用户功能 include(GDK_ROOT_PATH.'public/download.php');//单页下载 include(GDK_ROOT_PATH.'public/go.php');//跳转中间页 -include(GDK_ROOT_PATH.'public/daohang.php');//跳转中间页 +include(GDK_ROOT_PATH.'public/daohang.php');//导航页面 diff --git a/functions/security.php b/functions/security.php index 55b38e1..edcdef5 100644 --- a/functions/security.php +++ b/functions/security.php @@ -328,4 +328,68 @@ function log_login( $username, $password ) { } } -} \ No newline at end of file +} + +//ban yonghu +function gdk_edit_user_profile( $user ) { + if ( ! current_user_can( 'edit_users' ) ) return; + if ( get_current_user_id() == $user->ID ) return; + ?> + + + + + +
封禁用户 + +
+ ID, FALSE ) ) { + return new WP_Error( + 'gdk_banned','ERROR: 此账号已被封禁.' + ); + } + return $user; +} + + +add_action( 'edit_user_profile', 'gdk_edit_user_profile' ); +add_action( 'edit_user_profile_update', 'gdk_edit_user_profile_update' ); +add_filter( 'wp_authenticate_user', 'gdk_authenticate_user', 10, 2 ); \ No newline at end of file diff --git a/functions/user.php b/functions/user.php index 89a97e1..91bac60 100644 --- a/functions/user.php +++ b/functions/user.php @@ -22,7 +22,6 @@ function gdk_reset_password_message($message, $key) { add_filter('retrieve_password_message', 'gdk_reset_password_message', null, 2); - if (!defined('UM_DIR')) { /*判断是否按照UM插件*/ //注册表单 function gdk_show_extra_register_fields() { @@ -126,7 +125,6 @@ function gdk_show_myupload_library($wp_query) { } add_filter('parse_query', 'gdk_show_myupload_library'); - //添加后台个人信息 function gdk_contact_fields($contactmethods) { $contactmethods['qq'] = 'QQ'; @@ -166,10 +164,9 @@ function gdk_userid_value($value, $column_name, $id) { return $value; } add_filter('manage_users_custom_column', 'gdk_userid_value', 30, 3); -/** - * WordPress 后台用户列表显示用户昵称 - * https://www.wpdaxue.com/add-user-nickname-column.html - */ + + +//WordPress 后台用户列表显示用户昵称 add_filter('manage_users_columns', 'gdk_add_user_nickname'); function gdk_add_user_nickname($columns) { $columns['user_nickname'] = '昵称'; diff --git a/public/notify.php b/public/notify.php index 16bb246..37ccd11 100644 --- a/public/notify.php +++ b/public/notify.php @@ -2,7 +2,7 @@ /** * 支付推送服务消息接收文件 */ -require( '../../../../wp-load.php' ); +require( '../../../../wp-load.php' );//此路径位于根目录 /* Payjs支付通知开始 */ $data = payjs_notify();//获取payjs支付成功的信息 @@ -22,7 +22,7 @@ if(in_string($userid,'PP')){//免登陆支付,插入缓存,然后直接停止推 if(gdk_check($data['out_trade_no']) !== 0) exit('Repeat push');//在入库前,数据库不应该有同样的订单号 -if( empty($userid) || empty($money) )exit('data null');//阻止某些极少数空值的 +if( empty($userid) || empty($money) ) exit('data null');//阻止某些极少数空值的 /* Payjs支付通知结束 */