1.首先找到dede-〉API-〉uc.PHP文件
打开uc.PHP,将内容替换为:
/**************************二次开发说明**************************************
此模块应用于Dedecms5.7版本,请替换API文件夹的UC.PHP,替换后,通过DEDE注册的用户,
访问论坛系统可以免激活,实现同时登陆同时退出。
*****************************************版权:http://www.dede58.com**************/
include_once (dirname(__file__)."/../include/common.inc.PHP");
define('IN_disCUZ',FALSE);
define('UC_CLIENT_VERSION','1.5.0'); //note UCenter 版本标识
define('UC_CLIENT_RELEASE','20081031');
define('API_DELETEUSER',1); //note 用户删除 API 接口开关
define('API_REnameUSER',1); //note 用户改名 API 接口开关
define('API_GETTAG',1); //note 获取标签 API 接口开关
define('API_SYNLOGIN',1); //note 同步登录 API 接口开关
define('API_SYNlogoUT',1); //note 同步登出 API 接口开关
define('API_UPDATEPW',1); //note 更改用户密码 开关
define('API_UPDATEBADWORDS',1); //note 更新关键字列表 开关
define('API_UPDATEHOSTS',1); //note 更新域名解析缓存 开关
define('API_UPDATEAPPS',1); //note 更新应用列表 开关
define('API_UPDATECLIENT',1); //note 更新客户端缓存 开关
define('API_UPDATECREDIT',1); //note 更新用户积分 开关
define('API_GETCREDITSETTINGS',1); //note 向 UCenter 提供积分设置 开关
define('API_GETCREDIT',1); //note 获取用户的某项积分 开关
define('API_UPDATECREDITSETTINGS',1); //note 更新应用积分设置 开关
define('API_RETURN_SUCCEED','1');
define('API_RETURN_Failed','-1');
define('API_RETURN_FORBIDDEN','-2');
define('UC_CLIENT_ROOT',DEDEROOT.'/uc_clIEnt');
//note 普通的 http 通知方式
if(!defined('IN_UC')){error_reporting(0);set_magic_quotes_runtime(0);defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC',get_magic_quotes_gpc());$_DCACHE = $get = $post = array();$code = @$_GET['code'];parse_str(_authcode($code,'DECODE',UC_KEY),$get);if(MAGIC_QUOTES_GPC){ $get = _stripslashes($get);}$timestamp = time();if($timestamp - $get['time'] > 3600) { exit('Authracation has expirIEd');}if(empty($get)) { exit('InvalID Request');}$action = $get['action'];require_once UC_CLIENT_ROOT.'/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','getcreditsettings','updatecreditsettings'))){ $uc_note = new uc_note(); exit($uc_note->$get['action']($get,$post));}else{ exit(API_RETURN_Failed);}//note include 通知方式} else {exit('InvalID Request');}class uc_note{var $dbconfig = '';var $db = '';var $appdir = '';var $@R_502_5991@pre = 'dede_';function _serialize($arr,$HTMLon = 0){ if(!function_exists('xml_serialize')) { include_once UC_CLIENT_ROOT.'/lib/xml.class.PHP'; } return xml_serialize($arr,$HTMLon);}function uc_note(){ $this->appdir = DEDEROOT; $this->dbconfig = DEDEINC.'/common.inc.PHP'; $this->db = $GLOBALS['dsql']; $this->@R_502_5991@pre = $GLOBALS['cfg_dbprefix'];}function get_uIDs($uIDs){ include UC_CLIENT_ROOT.'/clIEnt.PHP'; $members = explode(",",$uIDs); empty($members) && exit(API_RETURN_FORBIDDEN); /*$members_username = array(); foreach($members as $ID) { $row = uc_get_user($ID,1); $members_username[] = $row[1]; } $comma_temps = implode(",$members_username); empty($comma_temps) && exit(API_RETURN_FORBIDDEN); $comma_uIDs = array();*/ //$row = $this->db->Setquery("SELECT mID FROM `dede_member` WHERE userID IN ($comma_temps)"); $this->db->Setquery("SELECT mID FROM `dede_member` WHERE mID IN ($uIDs)"); $this->db->Execute(); while($row = $this->db->GetArray()) { $comma_uIDs[] = $row['mID']; } empty($comma_uIDs) && exit(API_RETURN_FORBIDDEN); return implode(",$comma_uIDs);}function test($get,$post){ return API_RETURN_SUCCEED;}function deleteuser($get,$post){ $uIDs = $this->get_uIDs($get['IDs']); !API_DELETEUSER && exit(API_RETURN_FORBIDDEN); //note 用户删除 API 接口 $rs = $this->db->ExecuteNonequery2("DELETE FROM `dede_member` WHERE mID IN ($uIDs) AND matt<>10 limit 1"); if($rs > 0) { $this->db->ExecuteNonequery("DELETE FROM `dede_member_tj` WHERE mID IN ($uIDs) limit 1"); $this->db->ExecuteNonequery("DELETE FROM `dede_member_space` WHERE mID IN ($uIDs) limit 1"); $this->db->ExecuteNonequery("DELETE FROM `dede_member_company` WHERE mID IN ($uIDs) limit 1"); $this->db->ExecuteNonequery("DELETE FROM `dede_member_person` WHERE mID IN ($uIDs) limit 1"); //删除用户相关数据 $this->db->ExecuteNonequery("DELETE FROM `dede_member_stow` WHERE mID IN ($uIDs) "); $this->db->ExecuteNonequery("DELETE FROM `dede_member_flink` WHERE mID IN ($uIDs) "); $this->db->ExecuteNonequery("DELETE FROM `dede_member_guestbook` WHERE mID IN ($uIDs) "); $this->db->ExecuteNonequery("DELETE FROM `dede_member_operation` WHERE mID IN ($uIDs) "); $this->db->ExecuteNonequery("DELETE FROM `dede_member_pms` WHERE toID IN ($uIDs) OR fromID IN ($uIDs) "); $this->db->ExecuteNonequery("DELETE FROM `dede_member_frIEnds` WHERE mID IN ($uIDs) OR fID IN ($uIDs) "); $this->db->ExecuteNonequery("DELETE FROM `dede_member_vhistory` WHERE mID IN ($uIDs) OR vID IN ($uIDs) "); $this->db->ExecuteNonequery("DELETE FROM `dede_Feedback` WHERE mID IN ($uIDs) "); $this->db->ExecuteNonequery("UPDATE `dede_archives` SET mID='0' WHERE mID IN ($uIDs)"); } else { exit(API_RETURN_FORBIDDEN); } return API_RETURN_SUCCEED;}function renameuser($get,$post){ $uIDs = $this->get_uIDs($get['IDs']); $usernameold = $get['oldusername']; $usernamenew = $get['newusername']; if(!API_REnameUSER) { return API_RETURN_FORBIDDEN; } //note 获取标签 API 接口 $rs = $this->db->ExecuteNonequery2("UPDATE `dede_member` SET userID='$usernamenew' WHERE userID='$usernamenew' AND matt<>10 limit 1"); if($rs > 0) { $this->db->ExecuteNonequery("UPDATE `dede_archives` SET writer='$usernamenew' WHERE writer='$usernamenew'"); $this->db->ExecuteNonequery("UPDATE `dede_member_pms` SET floginID=REPLACE(floginID,'t$usernameold','t$usernamenew'),tologinID=REPLACE(tologinID,'t$usernamenew')"); $row = $this->db->Getone("SHOW @R_502_5991@ STATUS"); $db_@R_502_5991@s = $row['name']; unset($row); if(in_array($this->@R_502_5991@pre.'guestbook',$db_@R_502_5991@s)) { $this->db->ExecuteNonequery("UPDATE `dede_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'"); } if(in_array($this->@R_502_5991@pre.'story_books',$db_@R_502_5991@s)) { $this->db->ExecuteNonequery("UPDATE `dede_story_books` SET author='$usernamenew' WHERE author='$usernamenew'"); } if(in_array($this->@R_502_5991@pre.'groups',$db_@R_502_5991@s)) { $this->db->ExecuteNonequery("UPDATE `dede_groups` SET creater='$usernamenew' WHERE creater='$usernamenew'"); $this->db->ExecuteNonequery("UPDATE `dede_group_threads` SET author='$usernamenew' WHERE author='$usernamenew'"); $this->db->ExecuteNonequery("UPDATE `dede_group_user` SET username='$usernamenew' WHERE username='$usernamenew'"); $this->db->ExecuteNonequery("UPDATE `dede_group_posts` SET author='$usernamenew' WHERE author='$usernamenew'"); $this->db->ExecuteNonequery("UPDATE `dede_group_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'"); $this->db->ExecuteNonequery("UPDATE `dede_groups` SET ismaster=REPLACE(ismaster,'t$usernamenew')"); } return API_RETURN_SUCCEED; } else { return API_RETURN_FORBIDDEN; }}function gettag($get,$post){ $name = $get['ID']; if(!API_GETTAG) { return API_RETURN_FORBIDDEN; } //note 获取标签 API 接口 $name = trim($name); if(empty($name) || !preg_match('/^([x7f-xff_-]|w|s)+$/',$name) || strlen($name) > 20) { return API_RETURN_Failed; } $row = $this->db->Getone("SELECT `total`,`ID` FROM `dede_tagindex` WHERE `tag`='$name'"); if(!is_array($row)) { return API_RETURN_Failed; } $tpp = $row['total'] > 10 ? 10 : $row['total']; $IDs = array(); $this->db->Setquery("SELECT aID FROM `dede_tagList` WHERE `tID`='$row[ID]' AND arcrank>-1"); $this->db->Execute(); while($row = $this->db->GetArray()) { $IDs[] = $row['aID']; } if(empty($IDs)) { return API_RETURN_Failed; } $aIDs = implode(",$IDs); include_once DEDEINC.'/channelunit.func.PHP'; $archives_List = array(); $this->db->Setquery("SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepathFROM `dede_archives` arc left JOIN `dede_arctype` tp ON arc.typeID=tp.ID WHERE arc.ID IN($aIDs) ORDER BY ID DESC liMIT $tpp"); $this->db->Execute(); while($row = $this->db->GetArray()) { $row['url'] = GetfileUrl($row['ID'],$row['typeID'],$row['senddate'],$row['Title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); $row['url'] = !ereg('http:',$row['url']) ? $GLOBALS['cfg_basehost'].$row['url'] : $row['url']; if(!empty($row['url'])) { $archives_List[] = array('Title' => $row['Title'],'writer' => $row['writer'],'pubdate' => $row['pubdate'],'url' => $row['url']); } } $return = array($name,$archives_List); return $this->_serialize($return,1);}function synlogin($get,$post){ $uID = $get['uID']; $username = $get['username']; if(!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; } //note 同步登录 API 接口 header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); $result = $this->db->Getone("SELECT mID,pwd FROM `dede_member` WHERE `userID` like '$username' AND matt<>10"); if(is_array($result)) { include_once DEDEINC.'/memberlogin.class.PHP'; $cfg_ml = new MemberLogin(86400); $cfg_ml->PutLoginInfo($result['mID']); } else { //如果没有激活,则自动添加该用户到数据库,并设置已激活状态的cookie //会员的默认金币 $dfscores = 0; $dfmoney = 0; $dfrank = $this->db->Getone("Select money,scores From `dede_arcrank` where rank='10' "); if(is_array($dfrank)) { $dfmoney = $dfrank['money']; $dfscores = $dfrank['scores']; } $jointime = time(); $logintime = time(); $joinip = $get['regip']; $loginip = $get['regip']; $pwd = $get['password']; $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0); $mtype='个人'; $email=$get['email']; $inquery = "INSERT INTO `dede_member` (`mtype`,`userID`,`pwd`,`uname`,`sex`,`rank`,`money`,`email`,`scores`,`matt`,`spacesta`,`face`,`safequestion`,`safeanswer`,`jointime`,`joinip`,`logintime`,`loginip` ) VALUES ('$mtype','$username','$pwd','保密','10','$dfmoney','$email','$dfscores','0','$spaceSta','','$jointime','$joinip','$logintime','$loginip'); "; if($this->db->ExecuteNonequery($inquery)) { $mID = $this->db->GetLastID(); //写入默认会员详细资料 $space='person'; //写入默认统计数据 $membertjquery = "INSERT INTO `dede_member_tj` (`mID`,`article`,`album`,`archives`,`homecount`,`pagecount`,`Feedback`,`frIEnd`,`stow`) VALUES ('$mID','0'); "; $this->db->ExecuteNonequery($membertjquery); //写入默认空间配置数据 $spacequery = "Insert Into `dede_member_space`(`mID`,`pagesize`,`spacename`,`spacelogo`,`spacestyle`,`sign`,`spacenews`) Values('$mID','$username的空间','$space',''); "; $this->db->ExecuteNonequery($spacequery); //写入其它默认数据 $this->db->ExecuteNonequery("INSERT INTO `dede_member_flink`(mID,Title,url) VALUES('$mID','织梦内容管理系统','http://www.Dedecms.com'); "); include_once DEDEINC.'/membermodel.cls.PHP'; $membermodel = new membermodel($mtype); $modID=$membermodel->modID; $modelform = $this->db->getone("select * from dede_member_model where ID='$modID' "); $this->db->ExecuteNonequery("INSERT INTO `{$membermodel->@R_502_5991@}` (`mID`) VALUES ('$mID');"); //---------------------------------------------- //模拟登录 //--------------------------- include_once DEDEINC.'/memberlogin.class.PHP'; $cfg_ml = new MemberLogin(7*3600); $cfg_ml->PutLoginInfo($mID); } }}function synlogout($get,$post){ if(!API_SYNlogoUT) { return API_RETURN_FORBIDDEN; } //note 同步登出 API 接口 header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); include_once DEDEINC.'/memberlogin.class.PHP'; $cfg_ml = new MemberLogin(); $cfg_ml->Exitcookie();}function updatepw($get,$post){ if(!API_UPDATEPW) { return API_RETURN_FORBIDDEN; } $username = $get['username']; $password = $get['password']; //note 修改密码 API 接口 $newpw = md5($password); $this->db->ExecuteNonequery("UPDATE `dede_member` SET `pwd`='$newpw' WHERE `userID`='$username'"); return API_RETURN_SUCCEED;}function updatebaDWords($get,$post){ if(!API_UPDATEBADWORDS) { return API_RETURN_FORBIDDEN; } $row = $this->db->Getone("SELECT `value` FROM `dede_sysconfig` WHERE `varname`='cfg_replacestr'"); $baDWords = isset($row['value']) ? explode(",$row['value']) : array(); if(is_array($post)) { foreach($post as $k => $v) { if(in_array($v['find'],$baDWords)) continue; $baDWords[] = $v['find']; } } $baDWords_comma = !empty($baDWords) ? implode(",$baDWords) : ''; $this->db->ExecuteNonequery("UPDATE `dede_sysconfig` SET `value`='$baDWords_comma' WHERE `varname`='cfg_replacestr'"); $cachefile = DEDEDATA.'/config.cache.inc.PHP'; if(!is_writeable($cachefile)) { return API_RETURN_FORBIDDEN; } $fp = fopen($cachefile,'w'); $this->db->Setquery("SELECT `varname`,`type`,`value`,`groupID` From `dede_sysconfig` order by aID asc "); $this->db->Execute(); $s = ' |
总结
以上是内存溢出为你收集整理的织梦dedeCMS系统整合discuz论坛后会员注册后不用激活全部内容,希望文章能够帮你解决织梦dedeCMS系统整合discuz论坛后会员注册后不用激活所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)