<?php

if ($_POST) {
    /*
     *调用接口代码
     *
     **/
    require_once "../../API/qqConnectAPI.php";
    $qc = new QC();
    $ret = $qc->add_pic_t($_POST);
    echo "<meta charset='utf-8' />";
    if ($ret['ret'] == 0) {
        echo "发表成功,请查看微博";
    } else {
        echo "发表失败,请开启调试查看原因";
    }
} else {
    //load view
    require_once "get_repost_list.html";
}
Esempio n. 2
0
 /**
  * 腾讯微博分享
  */
 function tencent()
 {
     $this->type = 'QQ';
     $this->getConfig();
     vendor('qq.qq');
     $QC = new \QC();
     $QC->recorder->write("appid", $this->AppKey);
     $QC->recorder->write("appkey", $this->AppSecret);
     $QC->recorder->write("callback", 'http://' . $_SERVER['HTTP_HOST'] . "/Api/Share/tencent");
     $QC->reInit();
     //由于qq互联奇葩的回调地址规则,必须要完整的回调地址并且不能带有参数
     //所以将参数以session的形式存储
     //作者按:腾讯你个sb
     if ($_REQUEST['picurl']) {
         session("share_picurl", $_REQUEST['picurl']);
     }
     if ($_REQUEST['sharecomment']) {
         session("share_sharecomment", $_REQUEST['sharecomment']);
     }
     if ($_GET['table']) {
         session("share_table", $this->table);
     }
     if ($_GET['id']) {
         session("share_id", $this->id);
     }
     //==============================================
     if (empty($QC->recorder->read("access_token")) || empty($QC->recorder->read("openid"))) {
         if ($_GET['code']) {
             //已获得code
             $QC->qq_callback();
             $QC->get_openid();
             $QC->reInit();
             $_FILES['pic'] = "@." . session("share_picurl");
             $_POST['content'] = session("share_sharecomment") . "http://" . $_SERVER['HTTP_HOST'] . "/Portal/" . session("share_table") . "/info/id/" . session("share_id");
             $ret = $QC->add_pic_t($_POST);
             if ($ret['ret'] == 0) {
                 $this->table = session("share_table");
                 $this->id = session("share_id");
                 $this->share();
             } else {
                 alert("发表失败");
             }
         } else {
             //获取授权code
             $QC->qq_login();
         }
     } else {
         $_FILES['pic'] = "@." . session("share_picurl");
         $_POST['content'] = session("share_sharecomment");
         $ret = $QC->add_pic_t($_POST);
         if ($ret['ret'] == 0) {
             $this->share();
         } else {
             alert("发表失败");
         }
     }
 }