Commit 43362bae by shz

tospur

parent 5f52676f
# Only allow direct access to specific Web-available files.
# Apache 2.2
<IfModule !mod_authz_core.c>
Order Deny,Allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Akismet CSS and JS
<FilesMatch "^(form|akismet)\.(css|js)$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
# Akismet images
<FilesMatch "^(.+)\.(png|gif)$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
\ No newline at end of file
#submitted-on {
position: relative;
}
#the-comment-list .author .akismet-user-comment-count {
display: inline;
}
#the-comment-list .author a span {
text-decoration: none;
color: #999;
}
#the-comment-list .author a span.akismet-span-link {
text-decoration: inherit;
color: inherit;
}
#the-comment-list .remove_url {
margin-left: 3px;
color: #999;
padding: 2px 3px 2px 0;
}
#the-comment-list .remove_url:hover {
color: #A7301F;
font-weight: bold;
padding: 2px 2px 2px 0;
}
#dashboard_recent_comments .akismet-status {
display: none;
}
.akismet-status {
float: right;
}
.akismet-status a {
color: #AAA;
font-style: italic;
}
span.comment-link a {
text-decoration: underline;
}
span.comment-link:after {
content: " "attr(title) " ";
color: #aaa;
text-decoration: none;
}
.mshot-arrow {
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 10px solid #5C5C5C;
position: absolute;
left: -6px;
top: 91px;
}
.mshot-container {
background: #5C5C5C;
position: absolute;
top: -94px;
padding: 7px;
width: 450px;
height: 338px;
z-index: 20000;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-border-radius: 6px;
}
h2.ak-header {
padding: 30px;
background: #649316 url('img/logo-full-2x.png') no-repeat 20px center;
background-size: 185px 33px;
height: 33px;
text-indent: -9999em;
margin-right: 10px;
}
.checkforspam {
display: inline-block !important;
}
.checkforspam-spinner {
display: inline-block;
margin-top: 7px;
}
.config-wrap {
margin-top: 2em;
max-width: 700px;
}
.activate-option {
background: #e3e3e3;
border-radius: 3px;
margin-bottom: 30px;
overflow: hidden;
padding: 20px;
}
.activate-option.clicked {
background: #649316;
color: #fff;
}
.activate-option.clicked:hover {
background: #68802E;
color: #fff;
}
.activate-option .button.button-secondary {
margin: 15px 0;
}
.activate-option p {
margin: 10px 0 10px;
}
.activate-highlight {
background: #fff;
padding: 30px;
margin-right: 10px;
}
.activate-highlight.secondary {
background: #ddd;
padding: 20px 30px;
}
.activate-highlight h3 {
margin: 0 0 0.3em;
}
.activate-highlight p {
color: #777;
}
.activate-highlight .button-primary {
margin-top: 15px;
}
#akismet-enter-api-key .regular-text {
width: 18em;
margin-top: 15px;
}
.right {
float: right;
}
.alert-text {
color: #dd3d36;
}
.success {
color: #649316;
}
.option-description {
float: left;
font-size: 16px;
}
.option-description span {
color: #666;
display: block;
font-size: 14px;
margin-top: 5px;
}
.option-action {
float: right;
}
.key-config-link {
font-size: 14px;
margin-left: 20px;
}
.jetpack-account {
float: left;
font-size: 18px;
margin-right: 40px;
}
.small-heading {
color: #777;
display: block;
font-size: 12px;
font-weight: bold;
margin-bottom: 5px;
text-transform: uppercase;
}
.inline-label {
background: #ddd;
border-radius: 3px;
font-size: 11px;
padding: 3px 8px;
text-transform: uppercase;
}
.inline-label.alert {
background: #e54747;
color: #fff;
}
.jetpack-account .inline-label {
margin-left: 5px;
}
.option-action .manual-key {
margin-top: 7px;
}
.alert {
border: 1px solid #e5e5e5;
padding: 0.4em 1em 1.4em 1em;
border-radius: 3px;
-webkit-border-radius: 3px;
border-width: 1px;
border-style: solid;
}
.alert h3.key-status {
color: #fff;
margin: 1em 0 0.5em 0;
}
.alert.critical {
background-color: #993300;
}
.alert.active {
background-color: #649316;
}
.alert p.key-status {
font-size: 24px;
}
.alert p.description {
color:#fff;
font-size: 14px;
margin: 0 0;
font-style: normal;
}
.alert p.description a,
.alert p.description a,
.alert p.description a,
.alert p.description a {
color: #fff;
}
.new-snapshot {
margin-top: 1em;
padding: 1em;
text-align: center;
}
.new-snapshot.stats {
background: #fff;
border: 1px solid #e5e5e5;
}
.new-snapshot h3 {
background: #f5f5f5;
color: #888;
font-size: 11px;
margin: 0;
padding: 3px;
}
.new-snapspot ul {
font-size: 12px;
width: 100%;
}
.new-snapshot ul li {
color: #999;
float: left;
font-size: 11px;
padding: 0 20px;
text-transform: uppercase;
width: 33%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
}
.new-snapshot.stats ul li:first-child,
.new-snapshot.stats ul li:nth-child(2) {
border-right:1px dotted #ccc;
}
.new-snapshot.account ul li:nth-child(2) {
border-right: none;
}
.new-snapshot ul li span {
color: #52accc;
display: block;
font-size: 32px;
font-weight: lighter;
line-height: 1.5em;
}
.new-snapshot.stats {
}
.new-snapshot.account,
.new-snapshot.settings {
float: left;
padding: 0;
text-align: left;
width: 50%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
}
.account-container {
background: #fff;
border: 1px solid #e5e5e5;
margin-right: 0.5em;
}
.settings-container {
background: #fff;
border: 1px solid #e5e5e5;
margin-left: 0.5em;
}
.new-snapshot.account ul li {
width:100%
}
.new-snapshot.account ul li span {
font-size: 14px;
font-weight: normal;
}
.new-snapshot.settings ul li {
border: none;
display: block;
width:100%
}
.new-snapshot.settings ul li span {
display: block;
font-size: 14px;
font-weight: normal;
}
.new-snapshot.settings p.submit {
margin: 0;
text-align: center;
}
.akismet-settings th:first-child {
vertical-align: top;
padding-top: 15px;
}
.akismet-settings th.akismet-api-key {
vertical-align: middle;
padding-top: 0;
}
.akismet-settings input[type=text] {
width: 75%;
}
.akismet-settings span.note{
float: left;
padding-left: 23px;
font-size: 75%;
margin-top: -10px;
}
.clearfix {
clear:both;
}
\ No newline at end of file
jQuery( function ( $ ) {
$( 'a.activate-option' ).click( function(){
var link = $( this );
if ( link.hasClass( 'clicked' ) ) {
link.removeClass( 'clicked' );
}
else {
link.addClass( 'clicked' );
}
$( '.toggle-have-key' ).slideToggle( 'slow', function() {});
return false;
});
$('.akismet-status').each(function () {
var thisId = $(this).attr('commentid');
$(this).prependTo('#comment-' + thisId + ' .column-comment');
});
$('.akismet-user-comment-count').each(function () {
var thisId = $(this).attr('commentid');
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
});
$('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title]').each(function () {
// Comment author URLs are the only URL with a title attribute in the author column.
var thisTitle = $(this).attr('title');
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
$(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
if (thisTitle) {
$(this).after(
$( '<a href="#" class="remove_url">x</a>' )
.attr( 'commentid', thisCommentId[1] )
.attr( 'title', WPAkismet.strings['Remove this URL'] )
);
}
});
$('.remove_url').live('click', function () {
var thisId = $(this).attr('commentid');
var data = {
action: 'comment_author_deurl',
_wpnonce: WPAkismet.comment_author_url_nonce,
id: thisId
};
$.ajax({
url: ajaxurl,
type: 'POST',
data: data,
beforeSend: function () {
// Removes "x" link
$("a[commentid='"+ thisId +"']").hide();
// Show temp status
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) );
},
success: function (response) {
if (response) {
// Show status/undo link
$("#author_comment_url_"+ thisId)
.attr('cid', thisId)
.addClass('akismet_undo_link_removal')
.html(
$( '<span/>' ).text( WPAkismet.strings['URL removed'] )
)
.append( ' ' )
.append(
$( '<span/>' )
.text( WPAkismet.strings['(undo)'] )
.addClass( 'akismet-span-link' )
);
}
}
});
return false;
});
$('.akismet_undo_link_removal').live('click', function () {
var thisId = $(this).attr('cid');
var thisUrl = $(this).attr('href');
var data = {
action: 'comment_author_reurl',
_wpnonce: WPAkismet.comment_author_url_nonce,
id: thisId,
url: thisUrl
};
$.ajax({
url: ajaxurl,
type: 'POST',
data: data,
beforeSend: function () {
// Show temp status
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) );
},
success: function (response) {
if (response) {
// Add "x" link
$("a[commentid='"+ thisId +"']").show();
// Show link. Core strips leading http://, so let's do that too.
$("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) );
}
}
});
return false;
});
$('a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type').mouseover(function () {
var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://';
// Need to determine size of author column
var thisParentWidth = $(this).parent().width();
// It changes based on if there is a gravatar present
thisParentWidth = ($(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px';
if ($(this).find('.mShot').length == 0 && !$(this).hasClass('akismet_undo_link_removal')) {
var self = $( this );
$('.widefat td').css('overflow', 'visible');
$(this).css('position', 'relative');
var thisHref = $.URLEncode( $(this).attr('href') );
$(this).append('<div class="mShot mshot-container" style="left: '+thisParentWidth+'"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450" width="450" class="mshot-image" style="margin: 0;" /></div>');
setTimeout(function () {
self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2');
}, 6000);
setTimeout(function () {
self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3');
}, 12000);
} else {
$(this).find('.mShot').css('left', thisParentWidth).show();
}
}).mouseout(function () {
$(this).find('.mShot').hide();
});
$('.checkforspam:not(.button-disabled)').click( function(e) {
$('.checkforspam:not(.button-disabled)').addClass('button-disabled');
$('.checkforspam-spinner').addClass( 'spinner' );
akismet_check_for_spam(0, 100);
e.preventDefault();
});
function akismet_check_for_spam(offset, limit) {
$.post(
ajaxurl,
{
'action': 'akismet_recheck_queue',
'offset': offset,
'limit': limit
},
function(result) {
if (result.processed < limit) {
window.location.reload();
}
else {
akismet_check_for_spam(offset + limit, limit);
}
}
);
}
});
// URL encode plugin
jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
while(x<c.length){var m=r.exec(c.substr(x));
if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
}else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}
});
var ak_js = document.getElementById( "ak_js" );
if ( ! ak_js ) {
ak_js = document.createElement( 'input' );
ak_js.setAttribute( 'id', 'ak_js' );
ak_js.setAttribute( 'name', 'ak_js' );
ak_js.setAttribute( 'type', 'hidden' );
}
else {
ak_js.parentNode.removeChild( ak_js );
}
ak_js.setAttribute( 'value', ( new Date() ).getTime() );
var commentForm = document.getElementById( 'commentform' );
if ( commentForm ) {
commentForm.appendChild( ak_js );
}
else {
var replyRowContainer = document.getElementById( 'replyrow' );
if ( replyRowContainer ) {
var children = replyRowContainer.getElementsByTagName( 'td' );
if ( children.length > 0 ) {
children[0].appendChild( ak_js );
}
}
}
\ No newline at end of file
<?php
/**
* @package Akismet
*/
/*
Plugin Name: Akismet
Plugin URI: http://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
Version: 3.1.1
Author: Automattic
Author URI: http://automattic.com/wordpress-plugins/
License: GPLv2 or later
Text Domain: akismet
*/
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// Make sure we don't expose any info if called directly
if ( !function_exists( 'add_action' ) ) {
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
exit;
}
define( 'AKISMET_VERSION', '3.1.1' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) );
register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' );
add_action( 'init', array( 'Akismet', 'init' ) );
if ( is_admin() ) {
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' );
add_action( 'init', array( 'Akismet_Admin', 'init' ) );
}
//add wrapper class around deprecated akismet functions that are referenced elsewhere
require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' );
<?php
/**
* @package Akismet
*/
class Akismet_Widget extends WP_Widget {
function __construct() {
load_plugin_textdomain( 'akismet' );
parent::__construct(
'akismet_widget',
__( 'Akismet Widget' , 'akismet'),
array( 'description' => __( 'Display the number of spam comments Akismet has caught' , 'akismet') )
);
if ( is_active_widget( false, false, $this->id_base ) ) {
add_action( 'wp_head', array( $this, 'css' ) );
}
}
function css() {
?>
<style type="text/css">
.a-stats {
width: auto;
}
.a-stats a {
background: #7CA821;
background-image:-moz-linear-gradient(0% 100% 90deg,#5F8E14,#7CA821);
background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#7CA821),to(#5F8E14));
border: 1px solid #5F8E14;
border-radius:3px;
color: #CFEA93;
cursor: pointer;
display: block;
font-weight: normal;
height: 100%;
-moz-border-radius:3px;
padding: 7px 0 8px;
text-align: center;
text-decoration: none;
-webkit-border-radius:3px;
width: 100%;
}
.a-stats a:hover {
text-decoration: none;
background-image:-moz-linear-gradient(0% 100% 90deg,#6F9C1B,#659417);
background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#659417),to(#6F9C1B));
}
.a-stats .count {
color: #FFF;
display: block;
font-size: 15px;
line-height: 16px;
padding: 0 13px;
white-space: nowrap;
}
</style>
<?php
}
function form( $instance ) {
if ( $instance ) {
$title = $instance['title'];
}
else {
$title = __( 'Spam Blocked' , 'akismet');
}
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:' , 'akismet'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<?php
}
function update( $new_instance, $old_instance ) {
$instance['title'] = strip_tags( $new_instance['title'] );
return $instance;
}
function widget( $args, $instance ) {
$count = get_option( 'akismet_spam_count' );
echo $args['before_widget'];
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'];
echo esc_html( $instance['title'] );
echo $args['after_title'];
}
?>
<div class="a-stats">
<a href="http://akismet.com" target="_blank" title=""><?php printf( _n( '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', $count , 'akismet'), number_format_i18n( $count ) ); ?></a>
</div>
<?php
echo $args['after_widget'];
}
}
function akismet_register_widgets() {
register_widget( 'Akismet_Widget' );
}
add_action( 'widgets_init', 'akismet_register_widgets' );
<?php
# Silence is golden.
\ No newline at end of file
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
<input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'button button-primary';?>" value="<?php echo esc_attr( $text ); ?>"/>
</form>
\ No newline at end of file
<?php if ( $type == 'plugin' ) :?>
<div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
<style type="text/css">
.akismet_activate{min-width:825px;border:1px solid #4F800D;padding:5px;margin:15px 0;background:#83AF24;background-image:-webkit-gradient(linear,0% 0,80% 100%,from(#83AF24),to(#4F800D));background-image:-moz-linear-gradient(80% 100% 120deg,#4F800D,#83AF24);-moz-border-radius:3px;border-radius:3px;-webkit-border-radius:3px;position:relative;overflow:hidden}.akismet_activate .aa_a{position:absolute;top:-5px;right:10px;font-size:140px;color:#769F33;font-family:Georgia, "Times New Roman", Times, serif;z-index:1}.akismet_activate .aa_button{font-weight:bold;border:1px solid #029DD6;border-top:1px solid #06B9FD;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#FFF;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button:hover{text-decoration:none !important;border:1px solid #029DD6;border-bottom:1px solid #00A8EF;font-size:15px;text-align:center;padding:9px 0 8px 0;color:#F0F8FB;background:#0079B1;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#0079B1),to(#0092BF));background-image:-moz-linear-gradient(0% 100% 90deg,#0092BF,#0079B1);-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px}.akismet_activate .aa_button_border{border:1px solid #006699;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;background:#029DD6;background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#029DD6),to(#0079B1));background-image:-moz-linear-gradient(0% 100% 90deg,#0079B1,#029DD6)}.akismet_activate .aa_button_container{cursor:pointer;display:inline-block;background:#DEF1B8;padding:5px;-moz-border-radius:2px;border-radius:2px;-webkit-border-radius:2px;width:266px}.akismet_activate .aa_description{position:absolute;top:22px;left:285px;margin-left:25px;color:#E5F2B1;font-size:15px;z-index:1000}.akismet_activate .aa_description strong{color:#FFF;font-weight:normal}
</style>
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
<div class="akismet_activate">
<div class="aa_a">A</div>
<div class="aa_button_container" onclick="document.akismet_activate.submit();">
<div class="aa_button_border">
<div class="aa_button"><?php esc_html_e('Activate your Akismet account', 'akismet');?></div>
</div>
</div>
<div class="aa_description"><?php _e('<strong>Almost done</strong> - activate your account and say goodbye to comment spam', 'akismet');?></div>
</div>
</form>
</div>
<?php elseif ( $type == 'spam-check' ) :?>
<div id="akismet-warning" class="updated fade">
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
<p><?php printf( __( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ) ); ?></p>
<?php if ( $link_text ) { ?>
<p><?php echo $link_text; ?></p>
<?php } ?>
</div>
<?php elseif ( $type == 'version' ) :?>
<div id="akismet-warning" class="updated fade"><p><strong><?php printf( esc_html__('Akismet %s requires WordPress 3.0 or higher.', 'akismet'), AKISMET_VERSION);?></strong> <?php printf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/');?></p></div>
<?php elseif ( $type == 'alert' ) :?>
<div class='error'>
<p><strong><?php printf( esc_html__( 'Akismet Error Code: %s', 'akismet' ), $code ); ?></strong></p>
<p><?php echo esc_html( $msg ); ?></p>
<p><?php
/* translators: the placeholder is a clickable URL that leads to more information regarding an error code. */
printf( esc_html__( 'For more information: %s' , 'akismet'), '<a href="https://akismet.com/errors/' . $code . '">https://akismet.com/errors/' . $code . '</a>' );
?>
</p>
</div>
<?php elseif ( $type == 'missing-functions' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
<p class="description"><?php printf( __('Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> functions. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div>
<?php elseif ( $type == 'servers-be-down' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e("We can&#8217;t connect to your site.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Your firewall may be blocking us. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div>
<?php elseif ( $type == 'active-dunning' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e("Please update your payment details.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('We cannot process your transaction. Please contact your bank for assistance, and <a href="%s" target="_blank">update your payment details</a>.', 'akismet'), 'https://akismet.com/account/'); ?></p>
</div>
<?php elseif ( $type == 'cancelled' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e("Your subscription is cancelled.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Please visit the <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet'), 'https://akismet.com/account/'); ?></p>
</div>
<?php elseif ( $type == 'suspended' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e("Your subscription is suspended.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
</div>
<?php elseif ( $type == 'active-notice' && $time_saved ) :?>
<div class="wrap alert active">
<h3 class="key-status"><?php echo esc_html( $time_saved ); ?></h3>
<p class="description"><?php printf( __('You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet'), 'https://akismet.com/account/upgrade/'); ?></p>
</div>
<?php elseif ( $type == 'missing' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e( 'There is a problem with your key.', 'akismet'); ?></h3>
<p class="description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
</div>
<?php elseif ( $type == 'no-sub' ) :?>
<div class="wrap alert critical">
<h3 class="key-status failed"><?php esc_html_e( 'Your subscription is missing.', 'akismet'); ?></h3>
<p class="description"><?php printf( __('Since 2012, Akismet began using subscriptions for all accounts (even free ones). It looks like a subscription has not been assigned to your account, and we’d appreciate it if you’d <a href="%s" target="_blank">sign into your account</a> and choose one. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/' ); ?></p>
</div>
<?php elseif ( $type == 'new-key-valid' ) :?>
<div class="wrap alert active">
<h3 class="key-status"><?php esc_html_e('Your Akismet account has been successfully set up and activated. Happy blogging!', 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'new-key-invalid' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'new-key-failed' ) :?>
<div class="wrap alert critical">
<h3 class="key-status"><?php esc_html_e( 'The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) :?>
<div class="wrap alert critical">
<?php if ( $level == 'yellow' ): ?>
<h3 class="key-status failed"><?php esc_html_e("You're using your Akismet key on more sites than your Pro subscription allows.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('Your Pro subscription allows the use of Akismet on only one site. Please <a href="http://docs.akismet.com/billing/add-more-sites/">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.<br /><br />If you have any questions, please get in touch with our support team.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
<?php elseif ( $level == 'red' ): ?>
<h3 class="key-status failed"><?php esc_html_e("You're using Akismet on far too many sites for your Pro subscription.", 'akismet'); ?></h3>
<p class="description"><?php printf( __('To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
<?php endif; ?>
</div>
<?php endif;?>
<div class="no-key config-wrap"><?php
if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) :
if ( $akismet_user->status == 'missing' ) :?>
<p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. Register your email address below to get started.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
<div class="option-description">
<strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong>
<?php echo esc_attr( $akismet_user->user_email ); ?>
</div>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="auto-connect" value="<?php echo $akismet_user->ID;?>"/>
<input type="hidden" name="redirect" value="plugin-signup"/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Register Akismet' , 'akismet'); ?>"/>
</form>
</div>
<?php elseif ( $akismet_user->status == 'cancelled' ) :?>
<p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
<div class="option-description" style="width:75%;">
<strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong>
<?php printf( esc_html__( 'Your subscription for %s is cancelled' , 'akismet'), $akismet_user->user_email ); ?>
</div>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="user_id" value="<?php echo $akismet_user->ID;?>"/>
<input type="hidden" name="redirect" value="upgrade"/>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet'); ?>"/>
</form>
</div>
<?php elseif ( $akismet_user->status == 'suspended' ) : ?>
<p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site.', 'akismet'); ?></p>
<div class="activate-highlight centered activate-option">
<strong class="small-heading"><?php esc_html_e( 'Connected via Jetpack' , 'akismet'); ?></strong>
<h3 class="alert-text"><?php printf( esc_html__( 'Your subscription for %s is suspended' , 'akismet'), $akismet_user->user_email ); ?></h3>
<p><?php esc_html_e('No worries! Get in touch and we&#8217;ll help sort this out.', 'akismet'); ?></p>
<a href="https://akismet.com/contact" class="button button-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet'); ?></a>
</div>
<?php else : // ask do they want to use akismet account found using jetpack wpcom connection ?>
<p style="margin-right:10px"><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. To setup Akismet, select one of the options below.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
<div class="option-description">
<strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong>
<?php echo esc_attr( $akismet_user->user_email ); ?>
</div>
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="right">
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Use this Akismet account' , 'akismet'); ?>"/>
</form>
</div>
<?php endif;?>
<div class="activate-highlight secondary activate-option">
<div class="option-description">
<strong><?php esc_html_e('Create a new API key with a different email address', 'akismet'); ?></strong>
<p><?php esc_html_e('Use this option if you want to setup a new Akismet account.', 'akismet'); ?></p>
</div>
<?php Akismet::view( 'get', array( 'text' => __( 'Register a different email address' , 'akismet'), 'classes' => array( 'right', 'button', 'button-secondary' ) ) ); ?>
</div>
<div class="activate-highlight secondary activate-option">
<div class="option-description">
<strong><?php esc_html_e('Manually enter an API key', 'akismet'); ?></strong>
<p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
</div>
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
</form>
</div>
<?php else :?>
<p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. To setup Akismet, select one of the options below.', 'akismet'); ?></p>
<div class="activate-highlight activate-option">
<div class="option-description">
<strong><?php esc_html_e( 'Activate Akismet' , 'akismet');?></strong>
<p><?php esc_html_e('Log in or create an account to get your API key.', 'akismet'); ?></p>
</div>
<?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet'), 'classes' => array( 'right', 'button', 'button-primary' ) ) ); ?>
</div>
<div class="activate-highlight secondary activate-option">
<div class="option-description">
<strong><?php esc_html_e('Manually enter an API key', 'akismet'); ?></strong>
<p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
</div>
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
</form>
</div><?php
endif;?>
</div>
\ No newline at end of file
<div class="wrap">
<h2><?php esc_html_e( 'Akismet Stats' , 'akismet');?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="add-new-h2"><?php esc_html_e( 'Settings' , 'akismet');?></a><?php endif;?></h2>
<iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe>
</div>
\ No newline at end of file
<tr valign="top">
<th scope="row"><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend>
<p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Strict: silently discard the worst and most pervasive spam.', 'akismet'); ?></label></p>
<p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Safe: always put spam in the Spam folder for review.', 'akismet'); ?></label></p>
</fieldset></td>
</tr>
\ No newline at end of file
<?php
global $wpcom_api_key, $akismet_api_host, $akismet_api_port;
$wpcom_api_key = defined( 'WPCOM_API_KEY' ) ? constant( 'WPCOM_API_KEY' ) : '';
$akismet_api_host = Akismet::get_api_key() . '.rest.akismet.com';
$akismet_api_port = 80;
function akismet_test_mode() {
return Akismet::is_test_mode();
}
function akismet_http_post( $request, $host, $path, $port = 80, $ip = null ) {
$path = str_replace( '/1.1/', '', $path );
return Akismet::http_post( $request, $path, $ip );
}
function akismet_microtime() {
return Akismet::_get_microtime();
}
function akismet_delete_old() {
return Akismet::delete_old_comments();
}
function akismet_delete_old_metadata() {
return Akismet::delete_old_comments_meta();
}
function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) {
return Akismet::check_db_comment( $id, $recheck_reason );
}
function akismet_rightnow() {
if ( !class_exists( 'Akismet_Admin' ) )
return false;
return Akismet_Admin::rightnow_stats();
}
function akismet_admin_init() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_version_warning() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_load_js_and_css() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_nonce_field( $action = -1 ) {
return wp_nonce_field( $action );
}
function akismet_plugin_action_links( $links, $file ) {
return Akismet_Admin::plugin_action_links( $links, $file );
}
function akismet_conf() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_stats_display() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_stats() {
return Akismet_Admin::dashboard_stats();
}
function akismet_admin_warnings() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_comment_row_action( $a, $comment ) {
return Akismet_Admin::comment_row_actions( $a, $comment );
}
function akismet_comment_status_meta_box( $comment ) {
return Akismet_Admin::comment_status_meta_box( $comment );
}
function akismet_comments_columns( $columns ) {
_deprecated_function( __FUNCTION__, '3.0' );
return $columns;
}
function akismet_comment_column_row( $column, $comment_id ) {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_text_add_link_callback( $m ) {
return Akismet_Admin::text_add_link_callback( $m );
}
function akismet_text_add_link_class( $comment_text ) {
return Akismet_Admin::text_add_link_class( $comment_text );
}
function akismet_check_for_spam_button( $comment_status ) {
return Akismet_Admin::check_for_spam_button( $comment_status );
}
function akismet_submit_nonspam_comment( $comment_id ) {
return Akismet::submit_nonspam_comment( $comment_id );
}
function akismet_submit_spam_comment( $comment_id ) {
return Akismet::submit_spam_comment( $comment_id );
}
function akismet_transition_comment_status( $new_status, $old_status, $comment ) {
return Akismet::transition_comment_status( $new_status, $old_status, $comment );
}
function akismet_spam_count( $type = false ) {
return Akismet_Admin::get_spam_count( $type );
}
function akismet_recheck_queue() {
return Akismet_Admin::recheck_queue();
}
function akismet_remove_comment_author_url() {
return Akismet_Admin::remove_comment_author_url();
}
function akismet_add_comment_author_url() {
return Akismet_Admin::add_comment_author_url();
}
function akismet_check_server_connectivity() {
return Akismet_Admin::check_server_connectivity();
}
function akismet_get_server_connectivity( $cache_timeout = 86400 ) {
return Akismet_Admin::get_server_connectivity( $cache_timeout );
}
function akismet_server_connectivity_ok() {
_deprecated_function( __FUNCTION__, '3.0' );
return true;
}
function akismet_admin_menu() {
return Akismet_Admin::admin_menu();
}
function akismet_load_menu() {
return Akismet_Admin::load_menu();
}
function akismet_init() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_get_key() {
return Akismet::get_api_key();
}
function akismet_check_key_status( $key, $ip = null ) {
return Akismet::check_key_status( $key, $ip );
}
function akismet_update_alert( $response ) {
return Akismet::update_alert( $response );
}
function akismet_verify_key( $key, $ip = null ) {
return Akismet::verify_key( $key, $ip );
}
function akismet_get_user_roles( $user_id ) {
return Akismet::get_user_roles( $user_id );
}
function akismet_result_spam( $approved ) {
return Akismet::comment_is_spam( $approved );
}
function akismet_result_hold( $approved ) {
return Akismet::comment_needs_moderation( $approved );
}
function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
return Akismet::get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url );
}
function akismet_update_comment_history( $comment_id, $message, $event = null ) {
return Akismet::update_comment_history( $comment_id, $message, $event );
}
function akismet_get_comment_history( $comment_id ) {
return Akismet::get_comment_history( $comment_id );
}
function akismet_cmp_time( $a, $b ) {
return Akismet::_cmp_time( $a, $b );
}
function akismet_auto_check_update_meta( $id, $comment ) {
return Akismet::auto_check_update_meta( $id, $comment );
}
function akismet_auto_check_comment( $commentdata ) {
return Akismet::auto_check_comment( $commentdata );
}
function akismet_get_ip_address() {
return Akismet::get_ip_address();
}
function akismet_cron_recheck() {
return Akismet::cron_recheck();
}
function akismet_add_comment_nonce() {
return Akismet::add_comment_nonce( $post_id );
}
function akismet_fix_scheduled_recheck() {
return Akismet::fix_scheduled_recheck();
}
function akismet_spam_comments() {
_deprecated_function( __FUNCTION__, '3.0' );
return array();
}
function akismet_spam_totals() {
_deprecated_function( __FUNCTION__, '3.0' );
return array();
}
function akismet_manage_page() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_caught() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function redirect_old_akismet_urls() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_kill_proxy_check( $option ) {
_deprecated_function( __FUNCTION__, '3.0' );
return 0;
}
function akismet_pingback_forwarded_for( $r, $url ) {
return Akismet::pingback_forwarded_for( $r, $url );
}
function akismet_pre_check_pingback( $method ) {
return Akismet::pre_check_pingback( $method );
}
\ No newline at end of file
<?php
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/InsertDao.php');
require_once(PLUGIN_DIR . 'Tools/Image.php');
class SecHandHouse{
//二手房信息
public static function secHandHouse_html(){
wp_enqueue_script('bootstrapjs');
wp_enqueue_style('bootstrapcss');
global $wpdb;
$type = $_POST["type"];
if($type==2){
$wpdb->query("START TRANSACTION");
$result = SecHandHouse::secHouseData_insert();
if($result != 200){
$wpdb->query("ROLLBACK");
print_r($wpdb->last_error);;
echo "二手房房源新增失败";
}else{
$wpdb->query("COMMIT");
echo "二手房房源新增成功";
}
exit;
}else{
$context = array();
$context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
$context["photoType"] = SearchDao::searchPhotoType();
Timber::render("secHandHouse.html",$context);
}
}
public static function secHouseData_insert()
{
global $wpdb;
//图片信息
$uploadedfile = $_FILES['files'];
//房源与类型以及面积信息
$data = $_POST["data"];
//获取新房信息,存入tospur_house表
$insert_tospur_house_array = array(
'name' => $_POST['housename'],
'house_number' =>$_POST['house_number'],
'total_price' =>$_POST['total_price'],
'average_price' => $_POST['average_price'],
'buildproperty_id'=>$_POST['buildproperty_id'],
'covered_area' =>$_POST['covered_area'],
'floor' =>$_POST['floor'],
'faceto'=>$_POST['faceto'],
'decoration' => $_POST['decoration'],
'age'=>$_POST['age'],
'flat'=>$_POST['flat'],
'suite'=>$_POST["suite"],
'overview' => $_POST['overview'],
'address' => $_POST['address'],
'community_name'=>$_POST['community_name'],
'traffic' => $_POST['traffic'],
'periphery' => $_POST['periphery'],
'house_type' => 1
);
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE flat="' .$_POST['flat'] . '" and suite="' . $_POST["suite"] . '" and house_type=1', OBJECT);
if(!$res){
$houseId = InsertDao::insert_tospur_house($insert_tospur_house_array);
//主力房源的图片与房子信息关联插入数据库
if(isset($uploadedfile["name"])){
foreach($uploadedfile["name"] as $key=> $value) {
$uploadParam = array(
"name" => $uploadedfile["name"][$key],
"type" => $uploadedfile["type"][$key],
"tmp_name" => $uploadedfile["tmp_name"][$key],
"error" => $uploadedfile["error"][$key],
"size" => $uploadedfile["size"][$key]
);
//因为file提交过来有一个空的数组,所以这里判断在filename不为空的情况下,再做后续操作
if ($uploadParam["name"] != "") {
//上传图片
if (!function_exists('wp_handle_upload')) {
require_once(ABSPATH . 'wp-admin/includes/file.php');
}
$overrides = array('test_form' => false);
$movefile = wp_handle_upload($uploadParam, $overrides);
$str = preg_replace('#^https?://#', '', $movefile["url"]);
$length = strpos($str, "/",strpos($str, "/")+1);
$url = substr($str,$length);
if ($movefile && !isset($movefile['error'])) {
//上传成功后将图片信息存入tospur_image表
$insert_image_array = array(
'name' => $uploadParam["name"],
'path' => $url,
'creattime' => date("Y-m-d H:i:s"),
'alt' => "",
'image_type' =>$data[$key]["type"]
);
//插入图片表
$imgId =InsertDao::insert_tospur_image($insert_image_array);
$house_img_array = array(
'house_id' => $houseId,
'image_id' => $imgId,
);
$houseImgRes =InsertDao::insert_a_house_image($house_img_array);
} else {
return $movefile['error'];
echo "插入图片失败";
}
}
}
}
//插入推荐房源id与添加新房id到关联表a_house_recommend
if(isset($data["recommend"])){
foreach($data["recommend"] as $value){
$a_house_recommendArray = array(
"house_id" => $houseId,
"recommend_id" =>$value
);
$a_house_recommendRes =InsertDao::insert_a_house_recommend($a_house_recommendArray);
if($a_house_recommendRes == 504){
echo"推荐房源信息插入失败";
}
}
}
//插入推荐置业顾问user_id与新房id到关联表a_house_recommend
if($data["recConsultant"]){
foreach($data["recConsultant"] as $val){
$a_house_userArray = array(
"user_id" => $val,
"house_id" => $houseId,
"user_type" =>1
);
$a_house_userRes = InsertDao::insert_a_house_user($a_house_userArray);
if($a_house_userRes == 505){
echo"推荐置业顾问信息插入失败";
}
}
}
}else{
return 507;
}
return 200;
}
}
......@@ -2,6 +2,7 @@
class Config {
//table name
const A_DISTRICT_AREA_TABLE = 'a_district_area';
const DIC_CITY_TABLE = 'dic_city';
const DIC_ROOM_TABLE = 'dic_room';
const DIC_BUILDPROPERTY_TABLE = 'dic_buildproperty';
......@@ -11,6 +12,9 @@ class Config {
const DIC_PHOTOTYPE_TABLE = "dic_phototype";
const TOSPUR_ORGANIZATION_TABLE = 'tospur_organization';
const TOSPUR_CONSULTANT = 'tospur_consultant';
const TOSPUR_HOUSE_TABLE = 'tospur_house';
const TOSPUR_IMAGE_TABLE = 'tospur_image';
//sync url
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
......
<?php
//require_once(dirname(__FILE__) . '/Config.php');
class InsertDao{
public static function insert_tospur_house($params){
global $wpdb;
$houseRes = $wpdb->insert(Config::TOSPUR_HOUSE_TABLE, $params);
$houseId = $wpdb->insert_id;
if($houseRes){
return $houseId;
}else{
return 500;
}
}
public static function insert_tospur_image($params){
global $wpdb;
$imgRes = $wpdb->insert(Config::TOSPUR_IMAGE_TABLE, $params);
$imgId = $wpdb->insert_id;
if($imgRes){
return $imgId;
}else{
return 501;
}
}
public static function insert_a_district_area($params){
global $wpdb;
$districtAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $params);
if($districtAreaRes){
return $districtAreaRes;
}else{
return 502;
}
}
public static function insert_a_house_image($params){
global $wpdb;
$houseImageRes = $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $params);
if($houseImageRes){
return $houseImageRes;
}else{
return 503;
}
}
public static function insert_a_house_recommend($params){
global $wpdb;
$houseImageRes = $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $params);
if($houseImageRes){
return $houseImageRes;
}else{
return 504;
}
}
public static function insert_a_house_user($params){
global $wpdb;
$houseUserRes = $wpdb->insert(Config::A_HOUSE_USER_TABLE, $params);
if($houseUserRes){
return $houseUserRes;
}else{
return 505;
}
}
}
?>
\ No newline at end of file
<?php
require_once(PLUGIN_DIR . 'Config.php');
require_once(PLUGIN_DIR . 'Tools/Image.php');
class SearchDao
{
......@@ -158,7 +159,7 @@ class SearchDao
'name' => $value
)
);
if($insert){
if ($insert) {
$tags_ids[] = $wpdb->insert_id;
}
}
......@@ -198,18 +199,22 @@ class SearchDao
public static function ajax_searchHouse()
{
wp_send_json(SearchDao::searchHouse(
$house_result = SearchDao::searchHouse(
array(
'cityId' => $_GET['cityId'],
'districtId' => $_GET['districtId'],
'plateId' => $_GET['plateId'],
'buildPropertyId' => $_GET['buildPropertyId'],
'roomId' => $_GET['roomId'],
'acreage' => $_GET['acreage'],
'totalPrice' => $_GET['totalPrice'],
'searchText' => $_GET['searchText']
'cityId' => $_POST['cityId'],
'districtId' => $_POST['districtId'],
'plateId' => $_POST['plateId'],
'buildPropertyId' => $_POST['buildPropertyId'],
'roomId' => $_POST['roomId'],
'acreage' => $_POST['acreage'],
'totalPrice' => $_POST['totalPrice'],
'searchText' => $_POST['searchText'],
'houseType' => $_POST['houseType'],
'index' => $_POST['index']
)
));
);
$array = SearchDao::get_house_image_and_tags($house_result);
wp_send_json($array);
}
public static function searchHouse($array)
......@@ -298,4 +303,76 @@ class SearchDao
$result = $wpdb->get_results('select id,photo_name as value from ' . Config::DIC_PHOTOTYPE_TABLE);
return $result;
}
public static function ajax_searchConsultant()
{
wp_send_json(SearchDao::searchConsultant($_GET["consulCityId"], $_GET["consultantName"]));
}
public static function searchConsultant($consulCityId = NULL, $consultantName = NULL)
{
global $wpdb;
$sql = "select id,name as consultantName,imageUrl from " . Config::TOSPUR_CONSULTANT . " where 1=1";
$params = array();
if ($consulCityId != NULL) {
$params[] = $consulCityId;
$sql = $sql . " and cityId=%d";
}
if ($consultantName != NULL) {
$params[] = '%' . $consultantName . '%';
$sql = $sql . " and name like %s";
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
return $result;
}
public static function get_house_image_and_tags($house_result)
{
$array = array();
if ($house_result) {
$array['code'] = 2000;
$house_ids = array();
foreach ($house_result as $key => $value) {
$house_id = $value->id;
$house_ids[] = $house_id;
}
$string = '(' . implode(',', array_map('intval', $house_ids)) . ')';
$tag_result = SearchDao::search_house_tag($string);
//标签
if ($tag_result) {
foreach ($tag_result as $key => $value) {
$array['tags'][$value->house_id][] = $value->name;
}
}
//图片
$image_result = SearchDao::search_house_image($string);
if ($image_result) {
foreach ($image_result as $key => $value) {
$array['images'][$value->house_id] = home_url() . Image::getImage($value->path, 'small');
}
}
$array['result'] = $house_result;
} else {
$array['code'] = 2001;
}
return $array;
}
public static function search_house_image($house_ids)
{
$sql = 'select ahi.house_id,ti.path from a_house_image ahi' .
' left join tospur_image ti on ahi.image_id = ti.id' .
' where ti.image_type in (1,5) and house_id in ' . $house_ids . ' group by house_id';
global $wpdb;
return $wpdb->get_results($sql);
}
public static function search_house_tag($house_ids)
{
$sql = 'select aht.house_id,tt.name from a_house_tag aht' .
' left join tospur_tag tt on aht.tag_id = tt.id' .
' where house_id in ' . $house_ids;
global $wpdb;
return $wpdb->get_results($sql);
}
}
\ No newline at end of file
<?php
require_once(PLUGIN_DIR . 'Config.php');
class Image {
private static $imageSize = array(
'small' => array(120,90),
'normal' => array(320,270),
'big' => array(640,960)
);
public static function makeImage($name,$path){
foreach(Image::$imageSize as $item){
$image = wp_get_image_editor($path);
if(!is_wp_error($image)){
$image->resize($item[0],$item[1],true);
$imageName = explode(".",$name);
$image->save(str_replace($name,$imageName[0]."-{$item[0]}x{$item[1]}.".$imageName[1],$path));
}else{
return false;
}
}
return true;
}
public static function getImage($path,$size){
switch($size){
case "small":
$formatPath = Image::formatImageName($path,"small");
if(file_exists(Image::get_home_path().$formatPath)){
return $formatPath;
}
case "normal":
$formatPath = Image::formatImageName($path,"normal");
if(file_exists(Image::get_home_path().$formatPath)){
return $formatPath;
}
case "big":
$formatPath = Image::formatImageName($path,"big");
if(file_exists(Image::get_home_path().$formatPath)){
return $formatPath;
}
default:
return $path;
}
}
private static function get_home_path() {
$home = set_url_scheme( get_option( 'home' ), 'http' );
$siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
$wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
$home_path = trailingslashit( $home_path );
} else {
$home_path = ABSPATH;
}
return str_replace( '\\', '/', $home_path );
}
private static function formatImageName($path,$size){
$name = end(explode("/",$path));
$nameArray = explode(".",$name);
$imageSize = Image::$imageSize[$size];
return str_replace($name,$nameArray[0]."-{$imageSize[0]}x{$imageSize[1]}.".$nameArray[1],$path);
}
}
\ No newline at end of file
<?php
/*
Plugin Name: table_test
Plugin Name: 同策插件
Version: 1.0
Plugin URI: http://www.u-gen.net
Author: U-GEN TECH.
Description: 自定义列表
Author: 同策.
Description: 同策
*/
define('PLUGIN_DIR', dirname(__FILE__) . '\\');
define('PLUGIN_DIR', dirname(__FILE__) . '/');
add_action('init', 'tospur_init');
function tospur_init()
{
require_once(PLUGIN_DIR . 'Tools/TCSync.php');
require_once(PLUGIN_DIR . 'Tools/Image.php');
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Admin/House.php');
require_once(PLUGIN_DIR . 'Admin/newHouseList.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouse.php');
require_once('consultant_score.php');
require_once('view_house.php');
require_once(PLUGIN_DIR . 'Tools\TCSync.php');
require_once(PLUGIN_DIR . 'Dao\SearchDao.php');
require_once(PLUGIN_DIR . 'Admin\House.php');
add_action('admin_menu', 'reset_menu');
$type = $_POST["type"];
if($type==1){
wp_redirect("?page=newHouse&updated=true");
}
tospur_register_script_style();
tospur_ajax_set();
tospur_theme_format();
}
function tospur_theme_format(){
//移除
add_filter('admin_footer_text', tospur_remove_admin_footer_text, 1000);
......@@ -89,7 +86,8 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action( 'wp_ajax_searchHouse', 'SearchDao::ajax_searchHouse' );
add_action( 'wp_ajax_nopriv_searchHouse', 'SearchDao::ajax_searchHouse');
add_action( 'wp_ajax_searchConsultant', 'SearchDao::ajax_searchConsultant' );
add_action( 'wp_ajax_nopriv_searchConsultant', 'SearchDao::ajax_searchConsultant');
//后台处理 置业顾问评分
add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
//后台处理 置业顾问
......@@ -129,8 +127,10 @@ function update_consultant()
function reset_menu()
{
add_menu_page("talbe_test", "table_test", "manage_options", "1", "create_table");
add_menu_page( 'newHouse_title', '新房信息', 'manage_options', 'newHouse', 'House::init_view', 'dashicons-admin-tools', 6 );
add_menu_page("sync", "同步数据", "manage_options", "1", "do_sync");
add_menu_page('nesHouseList','新房列表', 'activate_plugins', 'newHouseList', 'newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', 'newHouse_title', '添加新房', 'activate_plugins', 'newHouse', 'House::init_view');
add_menu_page('secHandHouse','二手房', 'activate_plugins', 'secHandHouse', 'SecHandHouse::secHandHouse_html', 'dashicons-menu', 7);
//移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 );
global $menu;
......@@ -164,9 +164,9 @@ function reset_menu()
}
}
function create_table()
function do_sync()
{
//TCSync::user_sync();
TCSync::user_sync();
TCSync::organization_sync();
TCSync::other_sync();
}
......@@ -8,6 +8,8 @@ $const_register_page = home_url() . '/?page=register';
$const_forget_page = home_url() . '/?page=forget';
//我的
$const_my_page = home_url() . '/?page=my';
//我的楼盘
$const_myHouse_page = home_url() . '/?page=myHouse';
//预约看房
$const_view_page = home_url() . '/?page=view';
//约看清单
......
......@@ -8,7 +8,8 @@ $current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$consultant_id = $_GET['consultant_id'];
$current_user = wp_get_current_user();
$consultant_id = isset($_GET['consultant_id'])?$_GET['consultant_id']:$current_user->ID;
$context['consultant_id'] = $consultant_id;
$context['consultant_name'] = get_user_by('id', $consultant_id)->display_name;
$context['consultant'] = get_consultant_info($consultant_id);
......
<?php
/**
* Created by PhpStorm.
* User: UGEN79
* Date: 2015/8/6
* Time: 16:51
*/
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class consultantScoreList extends WP_List_Table
{
function __construct()
{
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'score', //singular name of the listed records
'plural' => 'scores', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
}
function column_default($item, $column_name)
{
switch ($column_name) {
case 'id':
case 'consultant':
case 'user':
case 'score':
return $item[$column_name];
case 'valid':
if ($item[$column_name]) {
return '<button data-valid="0" data-score-id="' . $item['id'] . '">设为无效</button>';
} else {
return '<button data-valid="1" data-score-id="' . $item['id'] . '">设为有效</button>';
}
default:
return print_r($item, true); //Show the whole array for troubleshooting purposes
}
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/
$this->_args['singular'], //Let's simply repurpose the table's singular label ("score")
/*$2%s*/
$item['id'] //The value of the checkbox should be the record's id
);
}
function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
'id' => 'ID',
'consultant' => '置业顾问',
'user' => '用户',
'score' => '评分',
'valid' => '状态'
);
return $columns;
}
function get_sortable_columns()
{
$sortable_columns = array(
'id' => array('id', false),
'consultant' => array('consultant', false),
'user' => array('user', false),
'score' => array('score', false),
'valid' => array('valid', false)
);
return $sortable_columns;
}
function get_bulk_actions()
{
$actions = array(
'invalid' => '设为无效',
'valid' => '设为有效',
);
return $actions;
}
function process_bulk_action()
{
$action = $this->current_action();
if ($action) {
$string = null;
$valid = null;
switch ($action) {
case 'invalid':
$score = $_GET['score'];
if ($score) {
$string = '(' . implode(',', array_map('intval', $score)) . ')';
$valid = 0;
}
break;
case 'valid':
$score = $_GET['score'];
if ($score) {
$valid = 1;
$string = '(' . implode(',', array_map('intval', $score)) . ')';
}
break;
}
global $wpdb;
$result = $wpdb->query('update tospur_consultant_score SET valid=' . $valid . ' where id in ' . $string);
}
}
function prepare_items()
{
global $wpdb;
$per_page = 5;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->process_bulk_action();
//$data = $this->example_data;
$sql = "SELECT s.id,c.display_name as consultant,u.user_login as user,s.score,s.valid FROM tospur_consultant_score s " .
"left join wp_users u on s.user_id = u.ID " .
"left join wp_users c on s.consultant_id = c.ID";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'consultant' => $value->consultant,
'user' => $value->user,
'score' => $value->score,
'valid' => $value->valid,
);
}
function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'valid'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function add_consultant_score_menu()
{
add_menu_page('置业顾问评分', '置业顾问评分', 'activate_plugins', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 26);
}
add_action('admin_menu', 'add_consultant_score_menu');
function consultant_score_page()
{
$consultantScoreList = new consultantScoreList();
$consultantScoreList->prepare_items();
?>
<div class="wrap">
<h2>置业顾问评分列表</h2>
<form id="scores-filter" method="get">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>"/>
<!-- Now we can render the completed list table -->
<?php $consultantScoreList->display() ?>
</form>
</div>
<script>
(function ($) {
$('button[data-score-id]').click(function () {
var self = $(this);
var score_id = $(this).data('score-id');
var valid = $(this).data('valid');
$.ajax({
type: 'POST',
url: '<?php echo admin_url()?>admin-ajax.php/',
data: 'action=valid_consultant_score&id=' + score_id + '&valid=' + valid,
success: function (data) {
if (data.code == 2000) {
if (valid == 0) {
self.text('设为有效');
self.data('valid', 1);
} else {
self.text('设为无效');
self.data('valid', 0);
}
alert('设置成功');
} else {
alert('设置失败');
}
}
});
return false;
});
})(jQuery);
</script>
<?php
}
?>
\ No newline at end of file
<?php
require_once(WP_PLUGIN_DIR."/tospur/Config.php");
$context = array();
$context['theme'] = get_template_directory_uri();
$context['siteUrl'] = get_site_url();
if(isset($_GET['hid'])){
$hid = $_GET['hid'];
$context['hid'] = $hid;
$sql = "select * from ".Config::TOSPUR_HOUSE_TABLE." where id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$hid));
$context['result'] = $result;
$context['cityName'] = SearchDao::getCityNameWithId($result->city_id);
$mainImagesSql = "SELECT db.literal as type,ada.house_area as area,ti.path FROM ".Config::A_DISTRICT_AREA_TABLE." ada
LEFT JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on db.value = ada.buildproperty_id
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on ti.id = ada.image_id
where ada.house_id = %d";
$mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid));
foreach($mainImage as $key => $value){
$value->path = Image::getImage($value->path,'small');
}
$context['mainImage'] = $mainImage;
$recommendSql = "select ahi.house_id as id,ti.path from a_house_image ahi
left join tospur_image ti on ahi.image_id = ti.id
where ti.image_type in (1,5) and house_id
in (select recommend_id from a_house_recommend where house_id = %d) group by house_id";
$recommends = $wpdb->get_results($wpdb->prepare($recommendSql,$hid));
foreach($recommends as $key => $value){
$value->path = Image::getImage($value->path,'small');
}
$context['recommends'] = $recommends;
$consultantSql = 'select id,name,mobile,imageUrl,s.average_score from tospur_consultant c
LEFT JOIN (select consultant_id,sum(score)/count(score) as average_score
from tospur_consultant_score
where valid=1 group by consultant_id) s on c.id = s.consultant_id
where id in(select user_id from a_house_user where user_type = 1 and house_id = %d);';
$consultant = $wpdb->get_results($wpdb->prepare($consultantSql,$hid));
$context['consultant'] = $consultant;
$imagesSql = 'select * from tospur_image ti
LEFT JOIN a_house_image ahi on ti.id = ahi.image_id
WHERE ahi.house_id = %d order by image_type;';
$images = $wpdb->get_results($wpdb->prepare($imagesSql,$hid));
foreach($images as $key => $value){
$value->path = Image::getImage($value->path,'big');
}
$context['images'] = $images;
Timber::render('detail.html', $context);
}else{
Timber::render('error.html', $context);
}
?>
\ No newline at end of file
......@@ -2,6 +2,7 @@
require_once(dirname(__FILE__) . '/dao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/SearchDao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Tools/Image.php');
add_filter('template_include', 'page_template');
function page_template($template)
......@@ -43,6 +44,12 @@ function page_template($template)
case 'myHouse':
$page = $theme . '/myHouse.php';
break;
case 'detail':
$page = $theme . '/detail.php';
break;
case 'map':
$page = $theme . '/map.php';
break;
}
return $page;
} else {
......@@ -191,25 +198,8 @@ function get_my_house()
}
}
add_action('wp_ajax_search_house', 'search_house');
function search_house()
{
$house_result = SearchDao::searchHouse(
array(
'cityId' => $_POST['cityId'],
'districtId' => $_POST['districtId'],
'plateId' => $_POST['plateId'],
'buildPropertyId' => $_POST['buildPropertyId'],
'roomId' => $_POST['roomId'],
'acreage' => $_POST['acreage'],
'totalPrice' => $_POST['totalPrice'],
'searchText' => $_POST['searchText'],
'index' => $_POST['index']
)
);
$array = get_house_image_and_tags($house_result);
wp_send_json($array);
}
add_action('wp_ajax_search_house', 'SearchDao::ajax_searchHouse');
add_action('wp_ajax_nopriv_search_house', 'SearchDao::ajax_searchHouse');
function get_house_image_and_tags($house_result)
{
......@@ -233,7 +223,7 @@ function get_house_image_and_tags($house_result)
$image_result = dao::search_house_image($string);
if ($image_result) {
foreach ($image_result as $key => $value) {
$array['images'][$value->house_id] = home_url() . $value->path;
$array['images'][$value->house_id] = home_url() . Image::getImage($value->path,'small');
}
}
$array['result'] = $house_result;
......@@ -243,4 +233,36 @@ function get_house_image_and_tags($house_result)
return $array;
}
add_action('wp_ajax_add_collect', 'add_collect');
function add_collect($house_id){
$insert_a_house_user_array = array(
'user_id' => get_current_user_id(),
'house_id' => $_POST["hid"],
'user_type' => 0
);
global $wpdb;
$result = $wpdb->insert('a_house_user', $insert_a_house_user_array);
$array = array();
if ($result) {
$array['code'] = 2000;
} else {
$array['code'] = 2001;
}
wp_send_json($array);
}
add_filter('login_redirect', 'new_login_redirect', 10, 3);
function new_login_redirect($redirect_to, $request, $user ){
if($user-ID>0) {
$role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor') {
return admin_url('admin.php?page=newHouseList');
} else {
return site_url();
}
}else{
return $redirect_to;
}
}
?>
\ No newline at end of file
<?php
$house_id = $_GET['id'];
$house_sql = 'SELECT v.id, h.name, u.user_login as phone, v.date, v.time, v.consultant_id as consultant_id, v.handle, v.handle_date FROM tospur_view_house v '
. 'left join tospur_house h on v.house_id = h.id '
. 'left join wp_users u on v.user_id = u.id '
. 'where v.id = ' . $house_id;
$consultant_sql = 'SELECT u.id,u.display_name FROM wp_users u '
. 'left join wp_usermeta m on u.id=m.user_id where meta_key="wp_user_level" and meta_value=7;';
global $wpdb;
$context['house_result'] = $wpdb->get_row($house_sql);
$context['consultant_result'] = $wpdb->get_results($consultant_sql);
$context['url'] = home_url();
$context['id'] = $house_id;
Timber::render('Admin/views/handle.html', $context);
?>
\ No newline at end of file
<?php
require_once(WP_PLUGIN_DIR."/tospur/Config.php");
$context = array();
$context['theme'] = get_template_directory_uri();
$context['siteUrl'] = get_site_url();
$context['address'] = $_GET['a'];
$context['city'] = $_GET['c'];
$context['point'] = $_GET['p'];
$context['houseName'] = $_GET['hn'];
Timber::render('map.html', $context);
?>
\ No newline at end of file
......@@ -7,32 +7,23 @@ $context['theme'] = get_template_directory_uri();
$current_user = wp_get_current_user();
$current_user_id = $current_user->ID;
if ($current_user_id == 0) {
$context['logout'] = array(
'login' => $const_login_page,
'register' => $const_register_page
);
wp_redirect(get_site_url()."?page=login");
} else {
$name = $current_user->user_login;
$role = $current_user->roles[0];
$user_role = '';
switch ($role) {
case 'contributor':
case 'administrator':
case 'subscriber':
$user_role = '用户';
wp_redirect(get_site_url()."?page=myHouse");
break;
case 'editor':
$user_role = '置业顾问';
/*header('Location: ' . $const_list_page);
exit;*/
break;
case 'administrator':
$user_role = '管理员';
wp_redirect(get_site_url()."?page=list");
break;
}
$context['login'] = array(
'name' => $user_role . $name,
'out' => wp_logout_url($const_login_page)
);
}
Timber::render('my.html', $context);
?>
\ No newline at end of file
......@@ -17,8 +17,11 @@ if ($user_id != 0) {
$context['user_id'] = $user_id;
$context['house_id'] = $_GET['house_id'];
$context['consultant_id'] = $_GET['consultant_id'];
Timber::render('view.html', $context);
}else{
wp_redirect(get_site_url()."?page=login");
exit;
}
Timber::render('view.html', $context);
?>
\ No newline at end of file
somthing error
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<style type="text/css">
body, html, #allmap {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
font-family: "微软雅黑";
}
.hn {
margin: 10px 0 5px 0
}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=DhzdodNVxoDSiBzRfZod4FG8"></script>
<title>地图</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
//map.html?a=南通市城山家园&hn=城山家园</br>同普路1220号&c=南通市&p=120.890824,31.971025
// 创建Map实例
var map = new BMap.Map("allmap");
var url_address = '{{address}}';
var url_city = '{{city}}';
var url_point = '{{point}}';
var url_houseName = "<a class='hn'>{{houseName}}</a>";
if (url_point) {
var pointLng = url_point.split(',')[0];
var pointLat = url_point.split(',')[1];
fromPoint(pointLng,pointLat);
} else if (!!url_address) {
fromAddress();
}
function fromAddress() {
// 创建地址解析器实例
var myGeo = new BMap.Geocoder();
// 将地址解析结果显示在地图上,并调整地图视野
myGeo.getPoint(url_address, function (point) {
if (point) {
map.centerAndZoom(point, 18);
map.addOverlay(new BMap.Marker(point));
showinfo(point);
} else {
alert("您选择地址没有解析到结果!");
}
},url_city);
}
function fromPoint(lng,lat) {
var point = new BMap.Point(lng, lat);
map.centerAndZoom(point, 18);
map.addOverlay(new BMap.Marker(point));
showinfo(point);
}
function showinfo(point) {
var opts = {
width: 0, // 信息窗口宽度
height: 0, // 信息窗口高度
//title: "楼盘名称", // 信息窗口标题
enableCloseOnClick: false, //
offset: new BMap.Size(10, -20) //信息窗位置偏移值
}
var infoWindow = new BMap.InfoWindow(url_houseName, opts); // 创建信息窗口对象
map.openInfoWindow(infoWindow, point); //开启信息窗口
}
function getUrlParam(name) {
var reg= new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]);
return null;
}
</script>
......@@ -65,19 +65,19 @@
<p class="has-feedback username">
<label for="phone" class="sr-only">用户名</label>
<input type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="手机号码">
<input tabindex="1" type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="手机号码">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback password">
<label for="password" class="sr-only">密码</label>
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<input tabindex="2" type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback code">
<label for="code" class="sr-only">验证码</label>
<input type="text" name="code" id="code" class="form-control input-lg" placeholder="验证码">
<input tabindex="3" type="text" name="code" id="code" class="form-control input-lg" placeholder="验证码">
<span id="send" class="form-control-feedback">发送验证码</span>
</p>
<input type="submit" id="register_submit" value="注册" class="btn btn-lg btn-block">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment