<?php define("CONSUMER_KEY", 'vPZ6aL6A6rSjXXb9'); define("CONSUMER_SECRET", 'JKO1d2btX8UjGehUX3pFOWdorWmVE1eU'); define("ACCESS_TOKEN", '74dd94519b1d410278283098b1c0baf0'); define("ACCESS_TOKEN_SECRET", 'a6e7d72f1b0f3db8f41a18c1d66f5063'); include_once 'api/tblog.class.php'; if ($_POST['submit'] == '上传') { $tblog = new TBlog(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET); if (isset($_FILES['element_1'])) { $target_path = 'saestor://images/temp_' . $_FILES['element_1']['name']; move_uploaded_file($_FILES['element_1']['tmp_name'], $target_path); $url = $tblog->upload($_REQUEST['text'], $target_path); $s = new SaeStorage(); $s->delete('images', 'temp_' . $_FILES['element_1']['name']); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>图床</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container">
/** * 发送网易微博 */ function sendNeteaseWeibo($row, $P) { // 如果没有得到本类微博的授权,不发表 if (!$P['neteaselastkey']) { return false; } $option = $P['typeoption']['netease']; if (!$option) { return false; } // 准备微博文字和图片 getWeiboText($row, $option, $weibocontent); try { $c = new TBlog(CONSUMER_KEY, CONSUMER_SECRET, $P['neteaselastkey']['oauth_token'], $P['neteaselastkey']['oauth_token_secret']); // 如果有图片,上传图片,发表有图片的微博 if ($weibocontent['imgurl']) { $rtninfo = $c->upload($weibocontent['text'], $weibocontent['imgurl']); } else { // 发表没有图片的微博 $rtninfo = $c->update($weibocontent['text']); } } catch (Exception $e) { return false; } if ($rtninfo['error_code']) { return false; } return "type=netease:id={$rtninfo['id']}"; }