Пример #1
0
 function Main()
 {
     if (!$this->Config['ldap_enable']) {
         $member = jsg_member_info(MEMBER_ID);
         $act_list = array();
         $act_list['qqwb'] = '腾讯微博';
         $act_list['sina'] = '新浪微博';
         $act_list['yy'] = 'YY帐号';
         $act_list['renren'] = '人人帐号';
         $act_list['kaixin'] = '开心帐号';
         if ($this->Config['fjau_enable']) {
             $act_list['fjau'] = 'FJAU帐号';
         }
         $act = isset($act_list[$this->Code]) ? $this->Code : 'qqwb';
         $this->Code = $act;
         if ('qqwb' == $act) {
             $qqwb_init = qqwb_init($this->Config);
             if ($qqwb_init) {
                 $qqwb = jconf::get('qqwb');
                 $qqwb_bind_info = qqwb_bind_info(MEMBER_ID);
                 if ($qqwb_bind_info) {
                     if ($qqwb['is_synctopic_toweibo']) {
                         $synctoqq_radio = jform()->YesNoRadio('synctoqq', (int) $qqwb_bind_info['synctoqq']);
                     }
                     if ($qqwb['is_synctopic_tojishigou']) {
                         $sync_weibo_to_jishigou_radio = jform()->YesNoRadio('sync_weibo_to_jishigou', (int) $qqwb_bind_info['sync_weibo_to_jishigou']);
                     }
                     if ($qqwb['is_syncreply_tojishigou']) {
                         $sync_reply_to_jishigou_radio = jform()->YesNoRadio('sync_reply_to_jishigou', (int) $qqwb_bind_info['sync_reply_to_jishigou']);
                     }
                 }
             }
         } elseif ('sina' == $act) {
             $profile_bind_message = '新浪微博帐号绑定功能未启用,请联系管理员';
             $sina_init = sina_init($this->Config);
             if ($sina_init) {
                 $sina = jconf::get('sina');
                 if ($sina['oauth2_enable']) {
                     $sina_bind_info = sina_weibo_bind_info(MEMBER_ID);
                     if ($sina_bind_info) {
                         $profiles = $sina_bind_info['profiles'];
                         if ($sina['is_synctopic_toweibo']) {
                             $synctoweibo_radio = jform()->YesNoRadio('bind_setting', (int) sina_weibo_bind_setting(MEMBER_ID));
                         }
                         if ($sina['is_synctopic_tojishigou']) {
                             $synctopic_tojishigou_radio = jform()->YesNoRadio('synctopic_tojishigou', (int) $profiles['synctopic_tojishigou']);
                         }
                         if ($sina['is_syncreply_tojishigou']) {
                             $syncreply_tojishigou_radio = jform()->YesNoRadio('syncreply_tojishigou', (int) $profiles['syncreply_tojishigou']);
                         }
                         $expires_in_time = my_date_format($sina_bind_info['dateline'] + $sina_bind_info['expires_in'], 'Y-m-d H:i');
                     }
                 } else {
                     $xwb_start_file = ROOT_PATH . 'include/ext/xwb/sina.php';
                     if (!is_file($xwb_start_file)) {
                         $profile_bind_message = '插件文件丢失,无法启动!';
                     } else {
                         require $xwb_start_file;
                         $profile_bind_message = '<a href="javascript:XWBcontrol.bind()">&#22914;&#26524;&#30475;&#19981;&#21040;&#26032;&#28010;&#24494;&#21338;&#32465;&#23450;&#35774;&#32622;&#31383;&#21475;&#65292;&#35831;&#28857;&#20987;&#36825;&#37324;&#21551;&#21160;&#12290;</a>';
                         $GLOBALS['xwb_tips_type'] = 'bind';
                         $profile_bind_message .= jsg_sina_footer();
                     }
                 }
             }
         } elseif ('yy' == $act) {
             $yy_init = yy_init($this->Config);
             if ($yy_init) {
                 $yy_bind_info = yy_bind_info(MEMBER_ID);
             }
         } elseif ('renren' == $act) {
             $renren_init = renren_init($this->Config);
             if ($renren_init) {
                 $renren_bind_info = renren_bind_info(MEMBER_ID);
             }
         } elseif ('kaixin' == $act) {
             $kaixin_init = kaixin_init($this->Config);
             if ($kaixin_init) {
                 $kaixin_bind_info = kaixin_bind_info(MEMBER_ID);
             }
         } elseif ('fjau' == $act) {
             $fjau_init = fjau_init($this->Config);
             if ($fjau_init) {
                 $fjau_bind_info = fjau_bind_info(MEMBER_ID);
             }
         } else {
         }
         $this->Title = $act_list[$act];
     }
     include template('setting/account_main');
 }
Пример #2
0
 function SyncReply()
 {
     $sina = jconf::get('sina');
     if (!$sina['is_syncreply_tojishigou']) {
         return;
     }
     $tid = max(0, (int) ($this->Post['tid'] ? $this->Post['tid'] : $this->Get['tid']));
     if (!$tid) {
         return;
     }
     $info = DB::fetch_first("select * from " . TABLE_PREFIX . "xwb_bind_topic where `tid`='{$tid}'");
     if (!$info) {
         return;
     }
     $mid = $info['mid'];
     if (!$mid) {
         return;
     }
     if ($sina['syncweibo_tojishigou_time'] > 0 && $info['last_read_time'] + $sina['syncweibo_tojishigou_time'] > time()) {
         return;
     }
     if (!($topic_info = DB::fetch_first("select * from " . TABLE_PREFIX . "topic where `tid`='{$tid}'"))) {
         return;
     }
     $xwb_bind_info = sina_weibo_bind_info($topic_info['uid']);
     if (!$xwb_bind_info) {
         return;
     }
     if (!sina_weibo_bind($topic_info['uid'])) {
         return;
     }
     if (!sina_weibo_syncreply_tojishigou($topic_info['uid'])) {
         return;
     }
     if (!$this->MemberHandler->HasPermission('xwb', '__syncreply', 0, $topic_info['uid'])) {
         return;
     }
     if ($this->module_config['oauth2_enable']) {
         $p = array('id' => $mid, 'access_token' => $xwb_bind_info['access_token']);
         $rets = sina_weibo_api('2/comments/show', $p, 'GET');
         $datas = $rets['comments'];
     } else {
         require_once ROOT_PATH . 'include/ext/xwb/sina.php';
         $wb = XWB_plugin::getWB();
         $datas = $wb->getComments($mid);
     }
     if ($datas) {
         krsort($datas);
         $TopicLogic = jlogic('topic');
         foreach ($datas as $data) {
             $mid = $data['idstr'] ? $data['idstr'] : ($data['mid'] ? $data['mid'] : $data['id']);
             $sina_uid = $data['user']['id'];
             if ($mid && ($bind_info = DB::fetch_first("select * from " . TABLE_PREFIX . "xwb_bind_info where `sina_uid`='{$sina_uid}'")) && !DB::fetch_first("select * from " . TABLE_PREFIX . "xwb_bind_topic where `mid`='{$mid}'") && ($content = trim(strip_tags(array_iconv('utf-8', $this->Config['charset'], $data['text'] . (isset($data['retweeted_status']) ? " /" . "/@{$data['retweeted_status']['user']['name']}: {$data['retweeted_status']['text']}" : "")))))) {
                 DB::query("insert into " . TABLE_PREFIX . "xwb_bind_topic (`mid`) values ('{$mid}')");
                 $_t = time();
                 if ($data['created_at']) {
                     $_t = strtotime($data['created_at']);
                 }
                 $_t = is_numeric($_t) ? $_t : 0;
                 $add_datas = array('totid' => $tid, 'content' => $content, 'from' => 'sina', 'type' => 'reply', 'uid' => $bind_info['uid'], 'timestamp' => $_t);
                 $add_result = $TopicLogic->Add($add_datas);
                 if (is_array($add_result) && count($add_result)) {
                     $_tid = max(0, (int) $add_result['tid']);
                     if ($_tid) {
                         if ($sina['is_syncimage_tojishigou'] && $data['original_pic']) {
                             $TopicLogic->_parse_url_image($add_result, $data['original_pic']);
                         }
                         DB::query("replace into " . DB::table('xwb_bind_topic') . " (`tid`, `mid`) values ('{$_tid}', '{$mid}')");
                     }
                 }
             }
         }
     }
     DB::query("update `" . TABLE_PREFIX . "xwb_bind_topic` set `last_read_time`='" . time() . "' where `tid`='{$tid}'");
 }
Пример #3
0
function sina_weibo_syn()
{
    $return = '';
    $uid = max(0, (int) ($uid ? $uid : MEMBER_ID));
    if ($uid > 0 && ($sys_config = sina_weibo_enable()) && jconf::get('sina', 'is_synctopic_toweibo')) {
        $row = sina_weibo_bind_info($uid);
        $a = $b = $c = $d = $e = '';
        if ($row && $row['sina_uid']) {
            $b = "{$sys_config['site_url']}/images/xwb/bgimg/icon_on.gif";
            if ((true === IN_JISHIGOU_INDEX || true === IN_JISHIGOU_AJAX || true === IN_JISHIGOU_ADMIN) && 'output' != jget('mod')) {
                $d = "checked='checked'";
                $dataSetting = 0;
                if (!sina_weibo_bind_setting($row)) {
                    $dataSetting = 1;
                    $b = "{$sys_config['site_url']}/images/xwb/bgimg/icon_off.gif";
                }
                $e = "<i></i><img id='syn_to_sina' src='{$b}' data-setting='{$dataSetting}' data-type='sina' onclick='modifySync(this);' title='同步发到新浪微博'/>";
            } else {
                $e = '<label><input type="checkbox" name="syn_to_sina" value="1" ' . (sina_weibo_bind_setting($row) ? ' checked="checked" ' : '') . ' />
					<img src="' . $b . '" title="同步发到新浪微博" /></label>';
            }
        } else {
            $b = "{$sys_config['site_url']}/images/xwb/bgimg/icon_off.gif";
            $c = "disabled='disabled'";
            $e = "<a href='{$sys_config['site_url']}/index.php?mod=account&code=sina' title='开通此功能(将打开新窗口)'><i></i><img src='{$b}'  data-setting='1' title='同步发到新浪微博'/></a>";
        }
        $return = "{$a}{$e}";
    }
    return $return;
}