Esempio n. 1
0
    function widget($args, $instance)
    {
        extract($args);
        ?>
		<?php 
        echo $before_widget;
        ?>
        <?php 
        if ($instance['title']) {
            echo $before_title . $instance['title'] . $after_title;
        }
        ?>
		<div class="joinus">如果您有不错的资源想发布至本站,您可以
		<?php 
        if (is_user_logged_in()) {
            ?>
			<a href="<?php 
            echo tin_get_user_url('post') . '&action=new';
            ?>
" target="_blank" title="投稿">点击投稿</a>
		<?php 
        } else {
            ?>
			<a href="#" class="user-login" title="登录后投稿">点击投稿</a>
		<?php 
        }
        ?>
。我们强烈推荐您注册本站账户或通过QQ、新浪微博登陆本站,使用投稿功能,畅享丰富资源以及积分服务。
		</div>
		<h3><span>站务合作</span></h3>
		<div class="sitecooperate">如果您有站务合作方面的需求,请通过以下方式联系我。<br>QQ: <?php 
        echo ot_get_option('tin_qq');
        ?>
<br>Email: <?php 
        $email = get_option('admin_email');
        echo str_replace('@', '#', $email);
        ?>
(#换成@)</div>
		<?php 
        echo $after_widget;
        ?>

	<?php 
    }
Esempio n. 2
0
function tin_user_profile_widget()
{
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        $li_output = '';
        $li_output .= '<li style="line-height:36px;clear: both;">' . tin_get_avatar($current_user->ID, '36', tin_get_avatar_type($current_user->ID), false) . sprintf(__('登录者 <a href="%1$s">%2$s</a>', 'tinection'), get_edit_profile_url($current_user->ID), $current_user->display_name) . '<a href="' . wp_logout_url(tin_get_current_page_url()) . '" title="' . esc_attr__('登出本帐号') . '">' . __('登出 &raquo;') . '</a></li>';
        if (!filter_var($current_user->user_email, FILTER_VALIDATE_EMAIL)) {
            $li_output .= '<li><a href="' . tin_get_user_url('profile') . '#pass">' . __('【重要】请添加正确的邮箱以保证账户安全', 'tinection') . '</a></li>';
        }
        $shorcut_links[] = array('title' => __('个人主页', 'tinection'), 'url' => get_author_posts_url($current_user->ID));
        if (current_user_can('manage_options')) {
            $shorcut_links[] = array('title' => __('管理后台', 'tinection'), 'url' => admin_url());
        }
        $can_post_cat = ot_get_option('tin_can_post_cat');
        if (count($can_post_cat)) {
            $shorcut_links[] = array('title' => __('文章投稿', 'tinection'), 'url' => add_query_arg('action', 'new', tin_get_user_url('post')));
        }
        $shorcut_html = '<li class="active">';
        foreach ($shorcut_links as $shorcut) {
            $shorcut_html .= '<a href="' . $shorcut['url'] . '">' . $shorcut['title'] . ' &raquo;</a>';
        }
        $shorcut_html .= '</li>';
        $credit = intval(get_user_meta($current_user->ID, 'tin_credit', true));
        $credit_void = intval(get_user_meta($current_user->ID, 'tin_credit_void', true));
        $unread_count = intval(get_tin_message($current_user->ID, 'count', "( msg_type='unread' OR msg_type='unrepm' )"));
        $collects = get_user_meta($current_user->ID, 'tin_collect', true) ? get_user_meta($current_user->ID, 'tin_collect', true) : 0;
        $collects_array = explode(',', $collects);
        $collects_count = $collects != 0 ? count($collects_array) : 0;
        $info_array = array(array('title' => __('文章', 'tinection'), 'url' => tin_get_user_url('post'), 'count' => count_user_posts($current_user->ID)), array('title' => __('评论', 'tinection'), 'url' => tin_get_user_url('comment'), 'count' => get_comments(array('status' => '1', 'user_id' => $current_user->ID, 'count' => true))), array('title' => __('收藏', 'tinection'), 'url' => tin_get_user_url('collect'), 'count' => intval($collects_count)));
        if ($unread_count) {
            $info_array[] = array('title' => __('未读', 'tinection'), 'url' => tin_get_user_url('message'), 'count' => $unread_count);
        }
        $info_array[] = array('title' => __('积分', 'tinection'), 'url' => tin_get_user_url('credit'), 'count' => $credit);
        $info_html = '<li>';
        foreach ($info_array as $info) {
            $info_html .= $info['title'] . '<a href="' . $info['url'] . '"> ' . $info['count'] . '</a>';
        }
        $info_html .= tin_whether_signed($current_user->ID);
        $info_html .= '</li>';
        $friend_html = '
	<li>
		<div class="input-group">
			<span class="input-group-addon">' . __('本页推广链接', 'tinection') . '</span>
			<input class="tin_aff_url form-control" type="text" class="form-control" value="' . add_query_arg('aff', $current_user->ID, tin_canonical_url()) . '">
		</div>
	</li>
	';
        return $li_output . $shorcut_html . $info_html . $friend_html;
    } else {
        $html = '<li><span class="local-account"><a data-sign="0" class="btn btn-primary user-login"><i class="fa fa-wordpress"></i>' . __('本地帐号', 'tinection') . '</a></span>';
        if (ot_get_option('tin_open_qq') == 'on') {
            $html .= '<span class="other-sign"><a class="qqlogin btn" href="' . home_url('/?connect=qq&action=login&redirect=' . urlencode(tin_get_redirect_uri())) . '"><i class="fa fa-qq"></i><span>' . __('QQ 登 录', 'tinection') . '</span></a></span>';
        }
        if (ot_get_option('tin_open_weibo') == 'on') {
            $html .= '<span class="other-sign"><a class="weibologin btn" href="' . home_url('/?connect=weibo&action=login&redirect=' . urlencode(tin_get_redirect_uri())) . '"><i class="fa fa-weibo"></i><span>' . __('微博登录', 'tinection') . '</span></a></span>';
        }
        $html .= '</li>';
        return $html;
    }
}
Esempio n. 3
0
function tin_new_user_notification($user_id, $plaintext_pass = '')
{
    $user = get_userdata($user_id);
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $message = sprintf(__('您的站点「%s」有新用户注册 :'), $blogname) . "<br></br>";
    $message .= sprintf(__('用户名: %s'), $user->user_login) . "<br>";
    $message .= sprintf(__('E-mail: %s'), $user->user_email) . "<br>";
    @tin_basic_mail('', get_option('admin_email'), sprintf(__('[%s] 有新用户注册'), $blogname), $message);
    if (empty($plaintext_pass)) {
        return;
    }
    $message = sprintf(__('用户名: %s'), $user->user_login) . "<br>";
    $message .= sprintf(__('密码: %s'), $plaintext_pass) . "<br>";
    $message .= tin_get_user_url('profile', $user->ID) . "<br>";
    @tin_basic_mail('', $user->user_email, sprintf(__('[%s] 您的注册用户名和密码'), $blogname), $message);
}
Esempio n. 4
0
            ?>
    <form action="<?php 
            echo get_option('siteurl');
            ?>
/wp-comments-post.php" method="post" id="commentform">
      <?php 
            if ($user_ID) {
                ?>
      <div class="author">
		<div id="real-avatar">
			<?php 
                echo tin_get_avatar($user_ID, '40', tin_get_avatar_type($user_ID));
                ?>
		</div>
		<div id="welcome"><a href="<?php 
                echo tin_get_user_url('profile');
                ?>
"><?php 
                echo $user_identity;
                ?>
</a>&nbsp;&nbsp;<a href="<?php 
                echo wp_logout_url(get_permalink());
                ?>
" title="退出"><?php 
                print __('退出', 'tinection');
                ?>
</a>
		</div>
	  </div>
	<?php 
            } elseif ('' != $comment_author) {
Esempio n. 5
0
function tin_saledl_pop()
{
    $sid = $_POST['sid'];
    $pid = $_POST['pid'];
    $current_user = wp_get_current_user();
    $uid = $current_user->ID;
    $saledl = get_post_meta($pid, 'tin_saledl', true);
    $saledlarray = explode(',', $saledl);
    $sidarray = explode('_', $sid);
    $sidarray[1] = isset($sidarray[1]) ? (int) $sidarray[1] : 1;
    $sidarray[1]--;
    $saledlsinglearray = explode('|', $saledlarray[$sidarray[1]]);
    $saledlsinglearray[2] = isset($saledlsinglearray[2]) ? (int) $saledlsinglearray[2] : 0;
    $price = $saledlsinglearray[2];
    $credit = (int) get_user_meta($uid, 'tin_credit', true);
    $msg = '';
    if ($price > $credit) {
        $enough = 0;
        $msg = '抱歉,积分不足,<a href="' . tin_get_user_url('credit') . '" target="_blank">充值积分</a>';
    } else {
        $enough = 1;
    }
    $return = array('enough' => $enough, 'price' => $price, 'credit' => $credit, 'sid' => $sid, 'msg' => $msg);
    $return = json_encode($return);
    echo $return;
    exit;
}
Esempio n. 6
0
function store_email_template($order_id, $from = '', $to, $title = '')
{
    $blogname = get_bloginfo('name');
    $order = get_the_order($order_id);
    $order_url = tin_get_user_url('orders', $order->user_id);
    $admin_email = get_bloginfo('admin_email');
    $user_name = $order->user_name;
    $user_ucenter_url = get_author_posts_url($order->user_id);
    $product_name = $order->product_name;
    $order_status_text = output_order_status($order->order_status);
    $order_total_price = $order->order_total_price;
    $order_time = $order->order_time;
    $content = '<p>以下是您的订单最新信息,您可进入“<a target="_blank" href="' . $order_url . '">订单详情</a>”页面随时关注订单状态,如有任何疑问,请及时联系我们(Email:<a href="mailto:' . $admin_email . '" target="_blank">' . $admin_email . '</a>)。</p><div style="background-color:#fefcc9; padding:10px 15px; border:1px solid #f7dfa4; font-size: 12px;line-height:160%;">商品名:' . $product_name . '<br>订单号:' . $order_id . '<br>总金额:' . $order_total_price . '<br>下单时间:' . $order_time . '<br>交易状态:<strong>' . $order_status_text . '</strong></div>';
    $html = store_email_template_wrap($user_name, $content);
    if (empty($from)) {
        $wp_email = 'no-reply@' . preg_replace('#^www\\.#', '', strtolower($_SERVER['SERVER_NAME']));
    } else {
        $wp_email = $from;
    }
    if (empty($title)) {
        $title = $blogname . '商城提醒';
    }
    $fr = "From: \"" . $blogname . "\" <{$wp_email}>";
    $headers = "{$fr}\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n";
    wp_mail($to, $title, $html, $headers);
    // 如果交易成功通知管理员
    if ($order->order_status == 4) {
        $content_admin = '<p>你的站点有新完成的支付宝交易订单,以下是订单信息:<div style="background-color:#fefcc9; padding:10px 15px; border:1px solid #f7dfa4; font-size: 12px;line-height:160%;">买家名:<a href="' . $user_ucenter_url . '" title="用户个人中心" target="_blank">' . $user_name . '</a><br>商品名:' . $product_name . '<br>订单号:' . $order_id . '<br>总金额:' . $order_total_price . '<br>下单时间:' . $order_time . '<br>交易状态:<strong>' . $order_status_text . '</strong></div>';
        $html_admin = store_email_template_wrap('', $content_admin);
        wp_mail($admin_email, $title, $html_admin, $headers);
    }
}
Esempio n. 7
0
            _e('会员特惠', 'tinection');
            ?>
</span><?php 
            if (getUserMemberType()) {
                ?>
<strong><?php 
                if ($currency == 1) {
                    echo '<em>¥</em>' . sprintf('%0.2f', $discount_arr[1]) . '<em>(元)</em>';
                } else {
                    echo '<em><i class="fa fa-gift"></i></em>' . sprintf('%0.2f', $discount_arr[1]) . '<em>(积分)</em>';
                }
                ?>
</strong><?php 
            } else {
                if (is_user_logged_in()) {
                    echo sprintf(__('非<a href="%1$s" target="_blank" title="开通会员">会员</a>不能享受该优惠', 'tinection'), tin_get_user_url('membership'));
                } else {
                    _e('<a href="javascript:" class="user-login">登录</a> 查看优惠', 'tinection');
                }
            }
        }
        ?>
</li>
							<?php 
    }
    ?>
							<li class="summary-amount"><span class="dt"><?php 
    _e('商品数量', 'tinection');
    ?>
</span><span class="dt-num"><?php 
    $amount = get_post_meta($post->ID, 'product_amount', true) ? (int) get_post_meta($post->ID, 'product_amount', true) : 0;
Esempio n. 8
0
" class="title"><?php 
    bloginfo('name');
    ?>
</a>
		<a href="<?php 
    echo tin_get_user_url('profile');
    ?>
" class="name">@&nbsp;<?php 
    echo $current_user->display_name;
    ?>
</a>
		<?php 
    $unread = intval(get_tin_message($current_user->ID, 'count', "msg_type='unread' OR msg_type='unrepm'"));
    if ($unread > 0) {
        ?>
<a href="<?php 
        echo tin_get_user_url('message');
        ?>
" title="<?php 
        _e('新消息', 'tinection');
        ?>
" class="new-message-notify"></a><?php 
    }
    ?>
		</div>
		<div class="clr"></div>
	</div>
<?php 
}
?>
</div>
Esempio n. 9
0
        $cat = !empty($_POST['post_cat']) ? $_POST['post_cat'] : '';
        if ($title && $content) {
            if (mb_strlen($content, 'utf8') < 140) {
                $message = __('提交失败,文章内容至少140字。', 'tinection');
            } else {
                $status = sanitize_text_field($_POST['post_status']);
                if ($action === 'edit') {
                    $new_post = wp_update_post(array('ID' => intval($_GET['id']), 'post_title' => $title, 'post_content' => $content, 'post_status' => $status === 'pending' ? 'pending' : 'draft', 'post_author' => get_current_user_id(), 'post_category' => $cat));
                } else {
                    $new_post = wp_insert_post(array('post_title' => $title, 'post_content' => $content, 'post_status' => $status === 'pending' ? 'pending' : 'draft', 'post_author' => get_current_user_id(), 'post_category' => $cat));
                }
                if (is_wp_error($new_post)) {
                    $message = __('操作失败,请重试或联系管理员。', 'tinection');
                } else {
                    update_post_meta($new_post, 'tin_copyright_content', htmlspecialchars($_POST['post_copyright']));
                    wp_redirect(tin_get_user_url('post'));
                }
            }
        } else {
            $message = __('投稿失败,标题和内容不能为空!', 'tinection');
        }
    }
}
//~ 投稿end
get_header();
get_template_part('includes/breadcrumbs');
?>
<!-- Header Banner -->
<?php 
$headerad = ot_get_option('headerad');
if (!empty($headerad)) {