oraclelee 2012-10-30 10:51:16 5273次浏览 8条回复 0 0 0

YII framework 整合ucenter 一直显示通信失败 根据教程来做的,但是整合的是 discuz! x 2.5 ,整合的时候,操作更改了配置,但还是 通信失败。

  • 回复于 2012-10-30 11:00 举报

    [attach]976[/attach]

  • 回复于 2012-10-30 11:05 举报

    因为 discuz ! x 2.5 里用的是ucenter 1.6 所以代码有些不一样。这是我改的:

    error_reporting(0);
    
    define('UC_CLIENT_VERSION', '1.6.0');
    define('UC_CLIENT_RELEASE', '20110501');
    
    define('API_DELETEUSER', 1);
    define('API_RENAMEUSER', 1);
    define('API_GETTAG', 1);
    define('API_SYNLOGIN', 1);
    define('API_SYNLOGOUT', 1);
    define('API_UPDATEPW', 1);
    define('API_UPDATEBADWORDS', 1);
    define('API_UPDATEHOSTS', 1);
    define('API_UPDATEAPPS', 1);
    define('API_UPDATECLIENT', 1);
    define('API_UPDATECREDIT', 1);
    define('API_GETCREDIT', 1);
    define('API_GETCREDITSETTINGS', 1);
    define('API_UPDATECREDITSETTINGS', 1);
    define('API_ADDFEED', 1);
    define('API_RETURN_SUCCEED', '1');
    define('API_RETURN_FAILED', '-1');
    define('API_RETURN_FORBIDDEN', '1');
    
    define('IN_API', true);
    define('CURSCRIPT', 'api');
    
    define('DISCUZ_ROOT', '../');
    
    if(!defined('IN_UC')) {
    	//require_once '../source/class/class_core.php';
    
    	//$discuz = C::app();
    	//$discuz->init();
    
    	require DISCUZ_ROOT.'./config.inc.php';
    
    	$get = $post = array();
    
    	$code = @$_GET['code'];
    	parse_str(authcode($code, 'DECODE', UC_KEY), $get);
    
    	if(time() - $get['time'] > 3600) {
    		exit('Authracation has expiried');
    	}
    	if(empty($get)) {
    		exit('Invalid Request');
    	}
    
    	include_once DISCUZ_ROOT.'./uc_client/lib/xml.class.php';
    	$post = xml_unserialize(file_get_contents('php://input'));
    
    	if(in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcredit', 'getcreditsettings', 'updatecreditsettings', 'addfeed'))) {
    		require_once DISCUZ_ROOT.'./include/db_mysql.class.php';
    		$GLOBALS['db'] = new dbstuff;
    		$GLOBALS['db']->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
    		$GLOBALS['tablepre'] = $tablepre;
    		unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    		$uc_note = new uc_note();
    		exit($uc_note->$get['action']($get, $post));
    	} else {
    		exit(API_RETURN_FAILED);
    	}
    } else {
    	//exit;
    	require_once DISCUZ_ROOT.'./config.inc.php';
    	require_once DISCUZ_ROOT.'./include/db_mysql.class.php';
    	$GLOBALS['db'] = new dbstuff;
    	$GLOBALS['db']->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
    	$GLOBALS['tablepre'] = $tablepre;
    	unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    }
    
  • 回复于 2012-10-30 11:18 举报

    自己在顶顶。。。

  • 回复于 2012-10-30 11:27 举报

    路径问题?
    protected 下面的api的 uc.php 不能直接访问,访问会发生错误,出现404错误。

  • 回复于 2012-10-30 11:36 举报

    终于解决啦,稍后会放出全部的说明。

  • 回复于 2012-10-30 11:39 举报

    [attach]977[/attach]

    哈哈 我整合通信成功啦。

  • 回复于 2012-10-30 14:07 举报

    哪儿的问题呢?????

  • 回复于 2013-07-30 17:32 举报

    学习一下

您需要登录后才可以回复。登录 | 立即注册