예제 #1
0
if ($_GET['do'] == "profile") {
    if (is_user_logged_in()) {
        if ($_POST['add_qq'] || $_POST['add_sina'] || $_POST['add_renren'] || $_POST['add_shuoshuo'] || $_POST['add_sohu'] || $_POST['add_netease'] || $_POST['add_douban'] || $_POST['add_tianya'] || $_POST['add_kaixin'] || $_POST['add_twitter']) {
            wp_connect_header();
        } else {
            $user_id = get_current_user_id();
            wp_user_profile_update($user_id);
            header('Location:' . admin_url('profile.php'));
        }
    }
}
if ($_GET['do'] == "page") {
    $wptm_options = get_option('wptm_options');
    $wptm_advanced = get_option('wptm_advanced');
    $password = $_POST['password'];
    if (isset($_POST['message'])) {
        if ($wptm_options['page_password'] && $password == $wptm_options['page_password'] || is_user_logged_in() && function_exists('wp_connect_advanced') && $wptm_advanced['registered_users']) {
            wp_update_page();
        } else {
            echo 'pwderror';
        }
    }
}
if ($_GET['do'] == "login") {
    $user = wp_connect_get_cookie("wp_connect_cookie_user");
    if ($user) {
        $user[0][1] = ifuser($user[0][1]);
        wp_connect_login($user[0], $user[1], '', true);
        header('Location:' . $user[2]);
    }
}
예제 #2
0
function wp_to_microblog()
{
    global $plugin_url;
    $wptm_options = get_option('wptm_options');
    $wptm_advanced = get_option('wptm_advanced');
    if (!$wptm_options['disable_ajax']) {
        wp_connect_action();
    }
    $password = $_POST['password'];
    if (isset($_POST['message'])) {
        if ($wptm_options['page_password'] && $password == $wptm_options['page_password'] || is_user_logged_in() && function_exists('wp_connect_advanced') && $wptm_advanced['registered_users']) {
            wp_update_page();
        } else {
            $pwderror = ' style="display:inline;"';
        }
    }
    ?>
<script type="text/javascript">
function textCounter(field,maxlimit){if(field.value.length>maxlimit){field.value=field.value.substring(0,maxlimit)}else{document.getElementById("wordage").childNodes[1].innerHTML=maxlimit-field.value.length}}
function selectall(form){for(var i=0;i<form.elements.length;i++){var box = form.elements[i];if (box.name != "chkall")box.checked = form.clickall.checked;}}
var wpurl = "<?php 
    echo $wpurl;
    ?>
";
</script>
<link type="text/css" href="<?php 
    echo $plugin_url;
    ?>
/css/page.css" rel="stylesheet" />
<form action="" method="post" id="tform">
  <fieldset>
    <div id="say">说说你的新鲜事
      <div id="wordage">你还可以输入 <span>140</span> 字</div>
    </div>
    <p id="v1"><textarea cols="60" rows="5" name="message" id="message" onblur="textCounter(this.form.message,140);" onKeyDown="textCounter(this.form.message,140);" onKeyUp="textCounter(this.form.message,140);"><?php 
    echo $pwderror ? $_POST['message'] : '';
    ?>
</textarea></p>
    图片地址:<p>
    <p id="v2"><input name="url" id="url" size="50" type="text" /></p>
    发布到:
    <p><label><input type="checkbox" id="clickall" onclick="selectall(this.form);" checked /> 全选</label>
<?php 
    $weibo_sync = wp_sync_list();
    foreach ($weibo_sync as $key => $name) {
        echo "<label><input name=\"{$key}\" id=\"{$key}\" type=\"checkbox\" value=\"1\" checked /> {$name}</label>\r\n";
    }
    ?>
</p>
    <?php 
    if (!is_user_logged_in() || !$wptm_advanced['registered_users']) {
        ?>
    <p id="v3">密码:
    <input name="password" id="password" type="password" value="<?php 
        echo !$pwderror ? $_POST['password'] : '';
        ?>
" /> <span<?php 
        echo $pwderror;
        ?>
>密码错误!</span>
	</p>
	<?php 
    }
    ?>
    <p><input type="submit" id="publish" value="发表" /></p>
    <p class="loading"><img src="<?php 
    echo $plugin_url;
    ?>
/images/loading.gif" alt="Loading" /></p>
	<p class="error">你没有绑定帐号,请到我的资料页面或者到插件页面绑定!</p>
	<p class="success">发表成功!</p>
  </fieldset>
</form>
<?php 
}