示例#1
0
        if ($xbt['mid'] < 1) {
            return;
        }
        $p['id'] = $xbt['mid'];
        if (in_array($topic['type'], array('both', 'forward'))) {
            $p['status'] = $content;
            $p['is_comment'] = 'both' == $topic['type'] ? 1 : 0;
            $rets = sina_weibo_api('2/statuses/repost', $p);
        } else {
            $p['comment'] = $content;
            $rets = sina_weibo_api('2/comments/create', $p);
        }
    }
    if ($rets['error'] && $rets['error_code']) {
        if (jget('debug')) {
            debug($rets);
        }
        jlog('to_xwb.inc', $rets);
    }
    $mid = $rets['idstr'] ? $rets['idstr'] : $rets['id'];
    if ($mid > 0) {
        DB::query("replace into " . DB::table('xwb_bind_topic') . " (`tid`, `mid`) values ('{$tid}', '{$mid}')");
    }
} else {
    $GLOBALS['jsg_tid'] = $data['tid'];
    $GLOBALS['jsg_totid'] = $data['totid'];
    $GLOBALS['jsg_message'] = $data['content'];
    $GLOBALS['jsg_imageid'] = $data['imageid'];
    require_once ROOT_PATH . 'include/ext/xwb/sina.php';
    require_once XWB_plugin::hackFile('newtopic');
}
 /**
  * 发表文章截获钩子:同步到微博
  * 由于发表文章的提示不是采用showmessage,而是用专用模板(template/default/portal/portalcp_article.htm;搜索add_success),
  * 故仍然只能采取老方法截获
  */
 function portalcp_article_sync_to_weibo_aftersubmit_output()
 {
     global $_G;
     switch ($this->_checkIsArticlePost()) {
         case 1:
             require XWB_plugin::hackFile('newarticle');
             break;
         default:
             break;
     }
 }