腾讯云网站解决方案帮您轻松应对建站成本高/网络不稳等常见问题

dedecms注册的会员自动激活discuz论坛

0
回复
542
查看
[复制链接]

691

主题

705

帖子

3万

积分

董事

Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72

积分
31859
     紫钻仅向指定用户开放  
发表于 19-4-26 21:18:01 | 显示全部楼层 |阅读模式
                dedecms整合discuz同步登录与退出并且不用激活
! l8 V6 g  |+ e7 Y7 ^   T  i8 d/ k% z% e8 N2 L8 K
    弄了一天,问题总算解决了,不过有点投机取巧,下面说下dedecms整合discuz后会员注册后不用激活的实现,以前做站时,一直在想,dede和 dz整合后,会员在网站注册后到论坛能不能不再激活,看着可不舒服,现在总算解决了,闲话不说了,下面进入正题,百度也不让发附件,只有啰嗦点了,呵呵, 比较长,分3篇:
3 {& M! o# J! l3 k4 n1.首先找到dede-〉api-〉uc.php文件/ ]/ i4 l' B8 M5 k, W) ^
打开uc.php,将内容替换为:
$ O8 j8 z" ?- T9 E* P" M- [<?php
" k# t1 q5 I0 A% x5 i4 i/**************************二次开发说明**************************************
7 D+ |: g: Y7 c' j, g# y8 l, i
此模块应用于DEDECMS5.6版本,请替换API文件夹的UC.PHP,替换后,通过DEDE注册的用户,
  R: j; u3 s& x$ f6 N8 k访问论坛系统可以免激活,实现同时登陆同时退出。1 U" p, Q+ y6 e/ W+ X5 L) Y
*****************************************版权:
http://www.zzjie.com**************/6 j! b) C* K5 x6 P* Q
include_once (dirname(__FILE__)."/../include/common.inc.php");6 L. p: E; [% z- }( U! _
define('IN_DISCUZ', FALSE);

$ g: [6 a/ K9 E2 Q) }8 a& Tdefine('UC_CLIENT_VERSION', '1.5.0'); //note UCenter 版本标识
. a1 {6 s5 W: v$ `$ a) j8 Qdefine('UC_CLIENT_RELEASE', '20081031');
& X4 W) \* P$ g' a" S- Z  S$ @
define('API_DELETEUSER', 1);   //note 用户删除 API 接口开关
; y4 U8 s9 P) }9 Hdefine('API_RENAMEUSER', 1);   //note 用户改名 API 接口开关5 R9 M. }. A$ E- y
define('API_GETTAG', 1);   //note 获取标签 API 接口开关
9 }* j0 q! ]* |) S8 }define('API_SYNLOGIN', 1);   //note 同步登录 API 接口开关+ R7 a# |9 p$ O& }, E& M! @
define('API_SYNLOGOUT', 1);   //note 同步登出 API 接口开关! p" a4 ~( K/ `, x3 q; a
define('API_UPDATEPW', 1);   //note 更改用户密码 开关
4 B7 N$ c- p4 k9 @define('API_UPDATEBADWORDS', 1); //note 更新关键字列表 开关
2 R0 R& y+ t$ k) o& adefine('API_UPDATEHOSTS', 1);   //note 更新域名解析缓存 开关
# S: ^/ D+ t: l  M( T3 J2 a* B. udefine('API_UPDATEAPPS', 1);   //note 更新应用列表 开关- s& v! K: Y8 z" B& j5 T
define('API_UPDATECLIENT', 1);   //note 更新客户端缓存 开关
$ G# ~" n0 P6 d+ M! n7 qdefine('API_UPDATECREDIT', 1);   //note 更新用户积分 开关
  {& z1 q4 Q* ?5 f* Adefine('API_GETCREDITSETTINGS', 1); //note 向 UCenter 提供积分设置 开关9 Y: S) Y* T3 {: x, b( B
define('API_GETCREDIT', 1);   //note 获取用户的某项积分 开关
8 n, G8 }# ^0 B" i% B# cdefine('API_UPDATECREDITSETTINGS', 1); //note 更新应用积分设置 开关

! F9 P6 b$ V) y* S6 `3 sdefine('API_RETURN_SUCCEED', '1');
5 [! b! T6 i% ~# m9 Odefine('API_RETURN_FAILED', '-1');
9 G; Q4 d1 B7 X; G5 X" `) C, edefine('API_RETURN_FORBIDDEN', '-2');

. C; x" e# D0 J; ]define('UC_CLIENT_ROOT', DEDEROOT.'/uc_client');  o* l; `5 g& h, ?4 T
//note 普通的 http 通知方式4 A, A7 }4 P% W& L) I
if(!defined('IN_UC'))8 y' G$ z! f" R3 ?! \4 P" t
{
$ ]9 l! A% o: D7 u
error_reporting(0);2 f: T& w) d  D7 W
set_magic_quotes_runtime(0);
6 Q# b  {% z% ^defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
4 _: h0 Y# E! u! |8 P( G
$_DCACHE = $get = $post = array();
5 ~1 r. H% m0 C1 T0 y" o2 y3 t) W$code = @$_GET['code'];1 Y- y- s; W- K' E6 X; e
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
& i0 b! _) H5 E  a( s0 s0 e; ~9 U$ i
7 ?! K  G' r6 [7 j/ h- fif(MAGIC_QUOTES_GPC)8 h" D' K( S0 ^! G. {3 r9 i* f
{
2 C$ \( C( p7 S5 L' U' Y. v) Z   $get = _stripslashes($get);
! X# C- t2 @! l}
# z. y; Z3 C( S. D2 v" O
$timestamp = time();1 S4 a2 n- Q3 y0 M1 C
if($timestamp - $get['time'] > 3600) {
4 Y  I: ^6 q& O* w   exit('Authracation has expiried');9 H" ]3 \* Q. f0 R7 e+ r5 W
}5 T8 |' Y. s% {0 X; u8 j+ d
if(empty($get)) {
- F( n0 x4 b; ]# V- g   exit('Invalid Request');8 v3 k! ~- O9 k0 `: ^0 G- Z& T0 l
}8 y. ]9 Z% Z! D7 r0 X- y, D# w- C
$action = $get['action'];
9 h: r6 y3 _0 k4 r3 h) L( A" U3 i
require_once UC_CLIENT_ROOT.'/lib/xml.class.php';9 ?( X! d, n9 n. V2 c
$post = xml_unserialize(file_get_contents('php://input'));

! ?! ~: u( ^. D9 y9 [2 lif(in_array($get['action'], array('test',  'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout',  'updatepw', 'updatebadwords', 'updatehosts', 'updateapps',  'updateclient', 'updatecredit', 'getcreditsettings',  'updatecreditsettings')))
. R4 s1 X$ Y# L{
5 ^/ S7 m' x' b4 C8 j" W% R   $uc_note = new uc_note();; R1 D& I( Z5 V* }/ S. Y
   exit($uc_note->$get['action']($get, $post));9 r1 Y' a9 o" s+ Q* `+ ]9 d
}else{
7 Q( E- Q/ t; b3 n2 N   exit(API_RETURN_FAILED);
. B3 ]. R8 d/ X# ~$ {% Z}

$ [; s' d. n2 S3 w3 b//note include 通知方式% A$ J% e3 W2 B7 L7 j
} else {

5 V# s0 m) A/ Iexit('Invalid Request');
4 R. l4 Z8 _- T}

# ]) H/ l" a5 S6 O3 ^" zclass uc_note
9 E: c2 A, A$ F: c{

$ ]( ]1 A6 P- Q: `var $dbconfig = '';; g* o* G9 ~, S8 g
var $db = '';
( s1 a" K  ^1 m& P% r8 L+ Lvar $appdir = '';
0 T7 a0 v' h! {  k  I0 b- Rvar $tablepre = 'dede_';% C/ T- m2 I2 i3 h5 I
4 [  z* [& ~7 N
function _serialize($arr, $htmlon = 0)
( L4 D* n9 Q& p( s{
+ W7 j8 N+ ?# l4 y( v* x   if(!function_exists('xml_serialize'))% @& D: |) @( R
   {. H5 O' S. p2 a: `% l0 Z
    include_once UC_CLIENT_ROOT.'/lib/xml.class.php';
; t# a+ n0 ]" ?   }8 U; e& W9 s4 X4 _$ M  V; D3 i
   return xml_serialize($arr, $htmlon);- }. z. e" A- {* N' {
}
! s2 ?6 j8 N+ L/ y8 g1 T2 O/ i
function uc_note()3 ?! P7 P& l; m) d  b5 ]
{
" p! h( b; e; w  `* _   $this->appdir = DEDEROOT;
  d: E9 X4 C6 P" C! Y$ h! m5 P   $this->dbconfig = DEDEINC.'/common.inc.php';* q. b: {& ^+ ^5 m2 W
   $this->db = $GLOBALS['dsql'];
1 T7 M0 G1 h9 J2 B7 W   $this->tablepre = $GLOBALS['cfg_dbprefix'];$ T& c8 z' i+ \, u+ J7 W  x' i" y  F
}2 `3 c5 G7 w! o+ O8 N8 F
3 J: D# d0 e- l" k
function get_uids($uids)
, W4 o+ }' c3 R8 \) h{
1 d5 f9 u% F) _& l   include UC_CLIENT_ROOT.'/client.php';
8 u) M% a5 W) {# U# W  
# y5 j+ T; L% r( ~* t   $members = explode(",", $uids);
- r# d" C( }( r4 M* E$ e7 m# ~) `   empty($members) && exit(API_RETURN_FORBIDDEN);& t; Y7 T' ]% Q) d
  $ F: i" {/ R) }; I2 t
   /*$members_username = array();- |# {" z7 J$ R; |
  
' e  G0 o7 y+ Q* p   foreach($members as $id)
7 R# |0 H  ]8 n" @. `' f6 ^) V; t. L   {
+ z1 L$ X8 A# f/ r    $row = uc_get_user($id,1);( w) b2 j+ {8 i# E+ x# a
    $members_username[] = $row[1];  - ^$ e( ?6 \- `! f2 \! k
   }
+ [5 H1 [2 c! T# s0 U6 v+ Z! A  
; E) l  b4 K2 e) }# C& m( d   $comma_temps = implode(",", $members_username);
& c4 B% i" s# L- L  
# O2 P1 ]* o) R9 A1 W1 X- M   empty($comma_temps) && exit(API_RETURN_FORBIDDEN);, y' `* o& o/ v( N6 K
  
- i6 S$ P8 \7 W- P   $comma_uids = array();*/" B, V$ m/ J: \$ I8 S5 k* j
  : m! x! [* b, z0 L6 a
   //$row = $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE userid IN ($comma_temps)");
9 P7 d/ |* H" U# H  6 ^! p5 |8 F: R
   $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE mid IN ($uids)");
$ l1 V3 ^" o3 {$ |" q% m0 T3 V; j   $this->db->Execute();  
) ~" }# m! z3 {   while($row = $this->db->GetArray())' \; E% J+ b) ~/ |$ H
   {
) l5 A& D0 Y) \0 x9 ?, w' {    $comma_uids[] = $row['mid'];
1 A+ l" I/ Q6 F( @   }
) B  @# i( y2 \* V5 \. y* L) F  
! Q# ~4 j. g& L( }: Y   empty($comma_uids) && exit(API_RETURN_FORBIDDEN);/ g( b/ D! w' z& w5 [5 i
  , U- ~5 a+ `! s3 u
   return implode(",", $comma_uids);% j/ t- {5 F: z; ]' z
}

5 g' s/ i4 l. s) U: q5 t' l& afunction test($get, $post)
  f6 p+ Q2 z4 T& \. F* q) b{' ~7 z, A- F) D* s# M7 Z; J
   return API_RETURN_SUCCEED;# @7 h0 A: {: b! u
}
! c  Y% d" [* \* _" U
function deleteuser($get, $post)
9 j! H* F+ Y  z9 J{
$ j( z9 k% e. p- e  ]6 V   $uids = $this->get_uids($get['ids']);
  c: {/ x, h3 x+ e& h; z   !API_DELETEUSER && exit(API_RETURN_FORBIDDEN);

: v& r2 ^2 B* ^$ _+ N. ^  o   //note 用户删除 API 接口" @' j4 X3 c# A3 v& r( A: O
   $rs = $this->db->ExecuteNoneQuery2("DELETE FROM
`dede_member` WHERE mid IN ($uids) AND matt<>10 limit 1");
8 r2 A+ U& H  p8 w4 h2 D; l   if($rs > 0)
' ~7 a& A" O8 a. _; g   {
, m+ I0 F% F& |' d& J    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_tj` WHERE mid IN ($uids) limit 1");
0 [% x2 e" J9 d    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_space` WHERE mid IN ($uids) limit 1");; C  g: p4 e& [9 c; {# L
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_company` WHERE mid IN ($uids) limit 1");
, O( H2 ~/ S( L1 g$ O9 }! n    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_person` WHERE mid IN ($uids) limit 1");, M  M4 w( U7 n7 j  V, T5 f$ c1 j
    j' p. u# @  R) @5 x6 J! d, h3 `
    //删除用户相关数据7 K, b8 i; X0 b  Q0 m& a# ~- o5 U
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_stow` WHERE mid IN ($uids) ");
, [  C$ U8 k6 H; W- [    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_flink` WHERE mid IN ($uids) ");5 v; z+ \, w, @
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_guestbook` WHERE mid IN ($uids) ");# t( x/ P2 t. R5 t& O$ h$ j
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_operation` WHERE mid IN ($uids) ");; e" t" @# s, t  ]/ y  l5 a2 @2 L
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_pms` WHERE toid IN ($uids) OR fromid IN ($uids) ");
. c1 W/ B. d; L, v/ U    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_friends` WHERE mid IN ($uids) OR fid IN ($uids) ");& i  O% Z# ]* o4 J" }
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_vhistory` WHERE mid IN ($uids) OR vid IN ($uids) ");8 ?3 H- m/ I$ f
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_feedback` WHERE mid IN ($uids) ");
" M& a, O6 P3 A) t& S    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET mid='0' WHERE mid IN ($uids)");. F" Y. L+ M' I$ O" J2 N
   }/ C7 D  i3 w. |3 D6 B
   else+ O# W0 o/ G( t/ u
   {; i& o  |* C$ A5 U
    exit(API_RETURN_FORBIDDEN);5 L- b: q. K: |) ]
   }

/ y3 L+ Q: ^8 o   return API_RETURN_SUCCEED;, W# C* _0 I" V) b
}
3 z. {( ]' v  |* O$ c/ O  Q9 ]
function renameuser($get, $post)
# s. U* Y/ L+ r. x; ~1 F, e9 s! u; |{
8 U% U+ J  P1 i0 ]   $uids = $this->get_uids($get['ids']);
3 }6 Y$ H  V: h0 h( L# E/ F' `+ h  ' z. }, E8 ~' p
  1 c  i- v* L- j. x* h' F( x, i
   $usernameold = $get['oldusername'];
$ |5 e4 d' Z- m( U   $usernamenew = $get['newusername'];  V% F- `' P9 {* q& d, V+ F7 @
   if(!API_RENAMEUSER)5 i( |" O/ R# P3 z# N8 Y" S
   {6 u* v! d& a- U8 E) ~
    return API_RETURN_FORBIDDEN;* e6 H, h) d  Y9 u0 \9 U
   }
8 W, Y% s$ q/ |, F6 C: q
   //note 获取标签 API 接口+ w! Y  k% e4 n; Q' f$ r. M
   $rs = $this->db->ExecuteNoneQuery2("UPDATE
`dede_member` SET userid='$usernamenew' WHERE userid='$usernamenew' AND matt<>10 limit 1");
% N" }1 N( X& B   if($rs > 0)
+ n3 A; y4 F, E' f   {7 g  l2 S, p" {8 s6 q* a% x7 n
    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET writer='$usernamenew' WHERE writer='$usernamenew'");
5 f, [, X. z- ~3 E    $this->db->ExecuteNoneQuery("UPDATE
`dede_member_pms`  SET floginid=REPLACE(floginid, 't$usernameold',  't$usernamenew'),tologinid=REPLACE(tologinid, 't$usernameold',  't$usernamenew')");( i! x9 j  X' Q; l0 V
   
! T5 z4 v; x! @   
5 K6 Z5 \0 T+ q) m( D    $row = $this->db->GetOne("SHOW TABLE STATUS");) \' D- o7 z) b! b+ v
    $db_tables = $row['Name']; unset($row);
/ M; @8 i0 w( V8 Y% W9 W   : ^. n3 p7 D3 t8 U! k
    if(in_array($this->tablepre.'guestbook',$db_tables))
; N, y- K3 V& I+ ]3 R! [    {
6 s7 ^- `, }9 ~0 ?2 i; {3 A     $this->db->ExecuteNoneQuery("UPDATE
`dede_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");
7 a) V$ E4 X1 d$ n    }
: r- J, A* v- D  s   
  X9 `- t( z/ O, X' d- B    if(in_array($this->tablepre.'story_books',$db_tables))
$ B. p: A8 U1 ^" m9 W9 h) q- v    {4 k1 ^: T5 U* z/ R
     $this->db->ExecuteNoneQuery("UPDATE
`dede_story_books` SET author='$usernamenew' WHERE author='$usernamenew'");2 a! Z# H0 f9 R! i
    }' X8 @4 I7 X. V3 {
   
9 G: n" k) B+ T, h" p, u# Y8 B    if(in_array($this->tablepre.'groups',$db_tables))
& Y' w- \, z; S8 P  [% E    {
  d) a: g5 v6 L0 y# ?  X  c     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET creater='$usernamenew' WHERE creater='$usernamenew'");
5 _2 f* @# P, \8 z2 F2 {+ G# ^     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_threads` SET author='$usernamenew' WHERE author='$usernamenew'");& @+ z4 c, g% F$ Y. r1 y; [
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_user` SET username='$usernamenew' WHERE username='$usernamenew'");
% l6 G& T2 t. N' r# T; ]     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_posts` SET author='$usernamenew' WHERE author='$usernamenew'");
: @/ P% r& w1 @' {     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");
" q- t" ]# k9 }& p! ]) w% a2 Q7 B' @     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET ismaster=REPLACE(ismaster, 't$usernameold', 't$usernamenew')");
) H) j. `0 D% y/ _$ Q    }7 {/ ?3 F; k7 W6 }# t4 u" H3 E
   6 n3 z* @! i" T! w! N* [! M
    return API_RETURN_SUCCEED;+ [9 ^0 @0 j8 y) P( `, C4 q  i" E
   }
! \! y3 g! h  W/ ~   else+ J/ p+ N& `+ c* P! H
   {
% \, @  X& J: C9 i7 |) ?( s# g    return API_RETURN_FORBIDDEN;% d" q  u  @& i6 }4 _
   }' Z; T. Q* k5 \
}
% _5 Z1 _) Y2 e1 i( r) U
function gettag($get, $post)- ~* s7 W" |8 S9 r) |; B- }
{
# y5 v6 l5 v* S& G/ J2 A2 u+ O   $name = $get['id'];
: O& X: [4 m; i' r   if(!API_GETTAG)
. f$ H& U) e2 b  b# a- q/ I: [   {; \8 h1 D+ [9 Q. O1 _6 Q
    return API_RETURN_FORBIDDEN;
6 F# c, h7 @4 s8 x, [4 s   }

  \4 C* n  V1 V- h   //note 获取标签 API 接口
+ s% i7 b0 p$ d# d! _# e0 j   $name = trim($name);
4 U* b& B- H) I" @. ]/ a- ^* g# e   if(empty($name) || !preg_match('/^([x7f-xff_-]|w|s)+$/', $name) || strlen($name) > 20)' x! W) P; }% V( b& w) Z0 Q- @& L
   {' s/ H5 [7 _- `4 Z
    return API_RETURN_FAILED;; J; c, c, ]5 f( b
   }

" X0 h9 _7 h9 y1 g9 o   $row = $this->db->GetOne("SELECT `total`,`id` FROM `dede_tagindex` WHERE `tag`='$name'");# ^, T, i; @+ i; A/ X+ x
   if(!is_array($row))
: y7 c5 D5 }6 x$ k   {
/ P8 r$ h5 }& z2 M2 S4 V% g; J    return API_RETURN_FAILED;% n" `- c' A9 Z  u
   }; S* C! L% h7 k7 Q4 h4 @3 l
  6 w5 h  \  G3 ^% q/ V/ P3 A: h
   $tpp = $row['total'] > 10 ? 10 : $row['total'];  5 m& A, `' g; ~, q
  
8 @! j  o8 n* i  W" K. y* F   $ids = array();
( u- W  o+ }3 g8 ~  ]) O8 I6 a1 V  
4 w' g/ i; R' f& B/ O, n   $this->db->SetQuery("SELECT aid FROM
`dede_taglist` WHERE `tid`='$row[id]' AND arcrank>-1");. B$ @. ^  @$ k) H% W% |
   $this->db->Execute();( b; e/ q) y7 r$ Q: j7 v
   while($row = $this->db->GetArray())% m" S: M$ r! ~& b4 a$ c( E; W  W% F
   {9 C+ {2 O5 l5 ?; X& v, ^/ J
    $ids[] = $row['aid'];   : F/ r' f% A! R' ~
   }; j8 q, ?! H: B- c$ Y
  
1 x2 p/ o& D0 m0 a   if(empty($ids))4 U/ s  U1 X, G/ _
   {+ R! s) `# A' ]8 c2 |) s9 d
    return API_RETURN_FAILED;
  ~6 N+ g+ a4 ]# t2 C   }+ o0 n  F! z, D* }* y( W" o
  0 @2 r8 v3 {! v+ C+ C# b
   $aids = implode(",", $ids);
: g% X/ i/ j$ Z9 C  d- ?  & T( l7 z: O+ l3 I1 |, _+ O
   include_once DEDEINC.'/channelunit.func.php';
- l! Z$ b" H- c7 t8 I4 o$ T  7 U# E) ]0 d7 \5 e6 |( a% z  H- g
   $archives_list = array();  
1 G( c! X8 s& L  r   $this->db->SetQuery("SELECT  arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath  
; b+ P/ W" W9 D! |9 {FROM
`dede_archives` arc LEFT JOIN `dede_arctype` tp ON arc.typeid=tp.id WHERE arc.id IN($aids) ORDER BY id DESC LIMIT $tpp");
4 z% p' ?/ f5 P2 [" D8 n   $this->db->Execute();
# F0 T; o& P% J0 g- s8 |   while($row = $this->db->GetArray())
* x4 Q$ a& J: U: L* w   {
' H* b" N! G2 b3 F    $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']);

; H8 f( X5 Y8 V: E( l0 |+ r8 `. {; \    $row['url'] = !ereg('http:',$row['url']) ? $GLOBALS['cfg_basehost'].$row['url'] : $row['url'];6 v# |/ n4 x/ O
   4 Q8 I9 P( H6 \5 i
    if(!empty($row['url']))
# r$ Z' X; l! @! \' _9 Y    {& V+ L  {% t* N' A
     $archives_list[] = array('title' => $row['title'],'writer' =>  $row['writer'],'pubdate' => $row['pubdate'],'url' =>  $row['url']);  Z( k. P; }) V5 F: L" v4 H; G" E0 d
    }
/ _' L7 {3 j. @  c0 m; t& k   }
% v% N7 y  ^: |  N
   $return = array($name, $archives_list);
. c/ z0 S, P1 A6 R: T8 A   return $this->_serialize($return, 1);( k" f7 `! s$ w9 y
}

7 z9 R% ]# d. a# P# C4 C. Hfunction synlogin($get, $post)
; K$ ]( s( N0 z/ o: B$ I{, V, d( A' u# K2 p
   $uid = $get['uid'];! k8 w! q3 q% C* g( ^9 b
   $username = $get['username'];
1 R# J! c7 m2 s6 T+ Q/ T6 C  Z   if(!API_SYNLOGIN)
4 K' g3 N* ]- _( w$ c6 U1 A   {1 A1 Z' t% `& g) |0 t# l
    return API_RETURN_FORBIDDEN;6 ]0 I0 s( m, N. Z- C" ^# s
   }
# F+ `9 w9 c+ i5 B! s& |
   //note 同步登录 API 接口
$ Y  w; X# _8 {5 t: N; @   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
' }! D( ^1 A# R: G- V+ Z   $result = $this->db->GetOne("SELECT mid,pwd FROM
`dede_member` WHERE `userid` like '$username' AND matt<>10");) ~0 M' E9 l" `1 d$ K) ?1 \
   if(is_array($result))
* G6 `; I% [" i  d; X4 ]0 ?; Y   {
. w3 T3 u, |7 A) Q$ e    include_once DEDEINC.'/memberlogin.class.php';
* f" }6 i; y' ~5 y7 G- f    $cfg_ml = new MemberLogin(86400);4 R& b9 B+ e8 z/ Q. ~- s. \2 G
    $cfg_ml->PutLoginInfo($result['mid']);8 X+ C9 Z, [. t# Q1 P
   }& \7 V: h0 O* W& ]1 o/ S
   else0 @0 Z: Z& C$ t+ `+ c- s- y8 y  V
   {   1 Y# i0 X) D7 E. A- D; [" x+ Y/ }- d4 d
    //如果没有激活,则自动添加该用户到数据库,并设置已激活状态的cookie
: S" f) ?7 l" q    //会员的默认金币( ~9 S5 s. g9 t
    $dfscores = 0;
9 p9 c# R& Q0 u- ]' e, K    $dfmoney = 0;
; e: x% M3 E/ r    $dfrank = $this->db->GetOne("Select money,scores From
`dede_arcrank` where rank='10' ");# C0 d& h, a" S4 B+ ?0 {
    if(is_array($dfrank)); O) O$ K2 k. u+ Y. j% N
    {& ?7 T3 o; T8 \& `6 n* K/ O
     $dfmoney = $dfrank['money'];
  w& H* t+ o. d! {9 a! Y     $dfscores = $dfrank['scores'];
5 Z% G0 Y6 {1 b; [/ e/ V3 L    }
; f8 B' M) P1 n! C- k$ l6 l1 ^    $jointime = time();+ Q, w8 t2 t7 e' h; f) A! G
    $logintime = time();) q9 @0 O4 r2 n, _3 r
    $joinip = $get['regip'];
) f9 J8 K1 x3 z" _- Q9 t9 o0 \    $loginip = $get['regip'];
: U' `  P0 O2 y4 k0 q/ ?0 X8 ]/ |    $pwd = $get['password'];0 o1 m- ?, o6 l" M9 n7 z5 F
   3 u. I3 X0 u5 W& c3 y5 E
    $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);
+ e4 D: v8 f- }3 Z9 Z7 w    $mtype='个人';. m: r& k2 G) c& f& n
    $email=$get['email'];
- G: o& b- |( Q4 G4 [8 u" j" f+ e   * y1 N& z, ~5 M6 x7 c9 Q
    $inQuery = "INSERT INTO
`dede_member` (`mtype` ,`userid` ,`pwd` ,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,- M* q, s5 `3 C- O
    `matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )9 h0 z: o! C! N) V6 ]7 K
     VALUES ('$mtype','$username','$pwd','$username','保密','10','$dfmoney','$email','$dfscores',- U6 D* i. t. a. E. l
     '0','$spaceSta','','','','$jointime','$joinip','$logintime','$loginip'); ";( g0 J! y4 ~$ P9 X/ o% }
   
& T! @2 y  S0 O. y+ r6 d    if($this->db->ExecuteNoneQuery($inQuery)). q" ?1 [6 A5 w5 m
    {   
! ~% F7 W8 B. ]) {4 ]     $mid = $this->db->GetLastID();( O# h; v  x' n- ~9 K' B& o0 h% b
  5 u1 E8 b( `. x
     //写入默认会员详细资料
+ q8 r) W5 M( n     $space='person';
9 s" y+ }8 q* i+ ?7 q% j  
& Q: [# N  i" R6 E% L6 E     //写入默认统计数据
2 T) r3 G+ ~/ _% P1 Q     $membertjquery = "INSERT INTO
`dede_member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)
: T8 ?# r5 {1 k1 X) v                 VALUES ('$mid','0','0','0','0','0','0','0','0'); ";
! v% l, y/ E5 Q: d: M0 N7 K     $this->db->ExecuteNoneQuery($membertjquery);5 c% @# z& }- Y
  8 w/ Y4 j/ N, Z. V" l( \, E8 x( I( ^
     //写入默认空间配置数据* G; a: T# j5 z! ~
     $spacequery = "Insert Into
`dede_member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)2 F7 X3 o- x, P" v6 k
               Values('$mid','10','0','$username的空间','','$space','',''); ";
6 a! T% @* \+ e" _6 F     $this->db->ExecuteNoneQuery($spacequery);
  k$ X% [/ z2 A% z5 `" j4 \  
  g& _8 t7 R: [  S1 H     //写入其它默认数据6 [; z0 q1 C$ }$ |
     $this->db->ExecuteNoneQuery("INSERT INTO
`dede_member_flink`(mid,title,url) VALUES('$mid','织梦内容管理系统','http://www.dedecms.com'); ");
  [' @: U: T- ]" }4 u+ ?" I  i    " ?: N0 ~4 q5 Z8 T* }! l2 y' {' x' s
     include_once DEDEINC.'/membermodel.cls.php'; 9 [/ M+ Z4 i: Q
   
/ p' L3 {, t: l     $membermodel = new membermodel($mtype);
8 u. Q( s/ v+ q4 F   
8 u5 N- ?2 L: p' ^- {     $modid=$membermodel->modid;. Q% g, c6 w) ]" `& K+ |4 \/ [
     
( c- @( `0 _% e8 o  F8 Y     $modelform = $this->db->getOne("select * from
dede_member_model where id='$modid' ");  a4 P/ b7 U" g2 R( j
   
! Y/ K  V5 H5 H/ ?7 t4 ~8 O     $this->db->ExecuteNoneQuery("INSERT INTO `{$membermodel->table}` (`mid`) VALUES ('$mid');");% y+ Z) W$ A! v1 T, P" I
        
2 {; a/ g* m4 {2 I2 u2 z* i     //----------------------------------------------! I7 a; g( s# q1 u0 [( V( `1 u- ~
     //模拟登录: z8 [8 ^" u+ C4 b0 P3 m3 ?
     //---------------------------1 ^) R0 _: L; ^8 [
     include_once DEDEINC.'/memberlogin.class.php';# {* x5 }& c+ x
     $cfg_ml = new MemberLogin(7*3600);! P5 Q3 }4 y/ Q" @$ `4 e) J
     $cfg_ml->PutLoginInfo($mid);    - K" f2 w, s2 `2 R$ `
   
0 U' y% C$ M4 [6 Z' H    }5 X( }8 B3 K- R" c
   
# T6 z$ r& G2 u2 i8 u# C% @   }) v( i% i% g- _$ h
}
# w6 w1 H* a& Z
function synlogout($get, $post)
" J: M3 [" i, O1 y- C$ \( T{
/ ~3 u) |+ J  Y, W8 A, w   if(!API_SYNLOGOUT)
) C6 [7 n. w  j. }" |5 S) T* s   {2 R+ |! B9 a4 N! i% }0 W: ?
    return API_RETURN_FORBIDDEN;
  U: h5 t% l0 ^3 B1 n) k# z" Q% Q! D   }

4 N+ z+ \# I; w" R   //note 同步登出 API 接口
- ?- A" P4 N* [6 z; v* A2 [7 ^   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');5 L# _9 \& ~" O: g9 h( `
   include_once DEDEINC.'/memberlogin.class.php';/ n1 X2 K7 @! D/ t0 B: N
   $cfg_ml = new MemberLogin();
! H9 c, s0 G' X& [: r% ~2 Z2 `   $cfg_ml->ExitCookie();& u& x( f# i; B# a' N
}

2 N" X9 M6 F  p/ J. |2 y- Bfunction updatepw($get, $post): I+ k2 y4 @6 V$ B
{
% x% D. P3 t- N! S  ?   if(!API_UPDATEPW)
5 {: x0 \3 [! d9 x, h5 _( B   {7 Q; b9 C0 v) D6 E( [. i6 w
    return API_RETURN_FORBIDDEN;0 y  {# F$ K$ u' G$ @
   }
; Y& ^/ H0 y$ _   $username = $get['username'];; C/ ?$ y3 i1 q
   $password = $get['password'];1 z5 V8 t, v- [1 s2 b& v* G# @
  
  K3 U$ Y# l' b' x5 Y1 M/ K! k$ k   //note 修改密码 API 接口. H1 @. G# J8 D% N
   $newpw = md5($password);
* S& o# p! p1 o% O& ^; y   $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `pwd`='$newpw' WHERE `userid`='$username'");
  m# l) o- v) H1 w$ r8 E9 d   return API_RETURN_SUCCEED;
: O) |9 R8 c) ]0 |9 O2 V. d" l}
* \, q, T2 u( P  P" T4 q/ p
function updatebadwords($get, $post)% a8 R7 e1 }: _4 A: P' ?
{
; {% j) h& b) r. D/ Z   if(!API_UPDATEBADWORDS)
- F" c4 B8 d( @; b0 P   {% H9 k6 l4 ^  U3 ?' e8 D) N
    return API_RETURN_FORBIDDEN;& @3 F% A6 s  r; M
   }

; r0 E  ?3 F  w# R0 k, F1 i1 l   $row = $this->db->GetOne("SELECT `value` FROM `dede_sysconfig` WHERE `varname`='cfg_replacestr'");
. g, x5 {* U. X* G5 z0 a  2 c4 m1 ^8 R. A6 M* t+ S! Q
   $badwords = isset($row['value']) ? explode(",", $row['value']) : array();
/ G9 a6 a5 p% e7 R  : D% o! }; E) t$ R' L
   if(is_array($post))
7 Y1 I& z/ |3 l   {
9 H! K8 b5 ]( J! n    foreach($post as $k => $v)
4 \3 Y, ^- w9 V. ]: b    {" X  Q! E3 i. }( n/ ?. i5 \4 Q
     if(in_array($v['find'],$badwords)) continue;
, \' B9 h) b3 c$ M" W     $badwords[] = $v['find'];' h4 _2 c9 q* [) F+ g* J
    }
' z1 M/ W; _# u% L$ L* ^   }
9 r7 J! q  }8 P' N4 Q: [
   $badwords_comma = !empty($badwords) ? implode(",", $badwords) : '';/ C+ K  F) t! T5 D7 a
  

: g4 R  F7 a/ Y+ C" I   $this->db->ExecuteNoneQuery("UPDATE `dede_sysconfig` SET `value`='$badwords_comma' WHERE `varname`='cfg_replacestr'");) V. P3 F6 V9 Z, }' k
  
  ^3 i( |+ B  F1 N( c- Y; m) h   $cachefile = DEDEDATA.'/config.cache.inc.php';
6 n6 l9 D4 @& K5 K8 z- x( J  
% n9 g) _/ O. [   if(!is_writeable($cachefile))% V. n7 i6 Z& z" Y) ]
   {
! S& x. G( m' C; d    return API_RETURN_FORBIDDEN;
" }2 t3 S: h, v7 e5 F6 z   }

. K! x; @1 {5 }   $fp = fopen($cachefile, 'w');
- H% K1 n: y; l  }% ~. p9 [1 t   $this->db->SetQuery("SELECT `varname`,`type`,`value`,`groupid` From
`dede_sysconfig` order by aid asc ");6 K3 M) `3 U: ]$ W0 b2 j! Z' q  \
   $this->db->Execute();
) M/ \1 @* q0 q- |8 J; `   $s = '<?php'."rn";
$ T6 `5 p$ O: u: u   while($row = $this->db->GetArray())# `1 {8 ^! H5 K# W! T9 u! \1 s
   {7 L, F0 E. D$ ~$ [$ C
    $s .= '$'.$row['varname'].' = '.($row['type']=='number' ?  $row['value'] : "'".str_replace("'",'',$row['value'])."'").";rn";0 f' {7 y8 ~) r  L" n6 Q, Q! X
   }0 q  O; v6 b# P+ y% Z4 Y
   $s .= '?>';! W/ R- N+ _6 A* `7 ?: s; N
   fwrite($fp, $s);7 \9 [- h9 G' B3 l5 _' }+ k
   fclose($fp);
4 P, z; z! @1 c  A5 ^   return API_RETURN_SUCCEED;
  P2 v/ u7 r2 q: g6 U' ?- ~}
3 B/ Z  e) u" N" p9 k$ [
function updatehosts($get, $post)5 d/ h6 u7 u. I) d: S& n! ^" X2 I
{& g: o  ~/ a8 F8 y9 o# L
   if(!API_UPDATEHOSTS)
% B& \: {6 n+ M0 k8 o   {  h- W* `. A3 v* U( s, `& t+ i+ B" O
    return API_RETURN_FORBIDDEN;
5 s+ H' A1 `/ z9 A   }
7 `. _5 Q" F( D   //note 理新HOST缓存 API 接口, z% {0 q4 ]& W: |/ H# ?
   $cachefile = UC_CLIENT_ROOT.'/data/cache/hosts.php';
: T5 ?( p- _% o4 Z" \" M& d   $fp = fopen($cachefile, 'w');
7 V# o4 T! @$ H2 A7 l   $s = "<?phprn";1 F  f4 N* S' l! r( X
   $s .= '$_CACHE['hosts'] = '.var_export($post, TRUE).";rn";6 S6 w7 ^" Q$ [
   fwrite($fp, $s);
3 ~. v3 N4 p% x7 @" t, u$ `   fclose($fp);
, E. u  Z9 \7 l   return API_RETURN_SUCCEED;, _& r  _9 M* x: N0 l# d
}
7 V5 B# ^2 q  F2 z. V
function updateapps($get, $post)& E; m, d; ^4 [, p
{
! i5 W/ ^+ c, H4 X/ z  R   if(!API_UPDATEAPPS)
1 v: u& Q% ^! g3 f) S   {" B1 a2 w+ b6 N, g$ W- \  @# k- z  O; U2 A
    return API_RETURN_FORBIDDEN;- H( Q: J, z/ _7 U1 M
   }- r% j; j- o; r3 L  i; |+ t
   $UC_API = $post['UC_API'];

, J- D6 R- _; }0 E5 l! B& l4 h: ?   //note 写 app 缓存文件
: e, N& |  R* i9 P4 x6 ]   $cachefile = UC_CLIENT_ROOT.'/data/cache/apps.php';
/ b* t; ~" |9 g: p: L! k( v   $fp = fopen($cachefile, 'w');6 L0 Q8 n5 G$ t! q
   $s = "<?phprn";/ Z, h* ~8 E$ Y" I/ J
   $s .= '$_CACHE['apps'] = '.var_export($post, TRUE).";rn";
' l' z, s( Z) l. n7 a   fwrite($fp, $s);  N4 F8 U" L! u) a3 C
   fclose($fp);

1 z" t! L! ?! d   return API_RETURN_SUCCEED;1 o- I2 p: A" y: K# X  w
}

9 _" N% s- l" W* |" z- Z7 }function updateclient($get, $post)
  y  y" F% U) g3 A+ @) |& a{6 O* r$ ^3 Y* }4 x1 N- C
   if(!API_UPDATECLIENT)2 |0 l0 w0 S+ P8 i/ Q
   {
1 |: H) b, ^! B0 ]* \& Y+ s    return API_RETURN_FORBIDDEN;
6 j) m5 }! G& V4 b  R  ^; ^   }# S- [  C/ B# H4 b3 D
   $cachefile = UC_CLIENT_ROOT.'/data/cache/settings.php';8 v1 w+ c  m9 @# i. v
   $fp = fopen($cachefile, 'w');
1 R+ [& @) d9 V) e. S   $s = '<?php'."rn";
- X0 T4 s7 m. S0 A6 `4 p$ A   $s .= '$_CACHE['settings'] = '.var_export($post, TRUE).";rn";3 e0 v+ T$ d. s# z5 |; }3 k9 l
   fwrite($fp, $s);
5 c; W/ p/ x- [+ K, `+ W- b   fclose($fp);7 t6 [- U4 V: x) `4 u: J; r( u
  - P! N4 h4 U' J! b) k9 h
   return API_RETURN_SUCCEED;
+ u5 o5 r2 i' J2 J$ H2 j( q- i. m}
, _/ N+ N8 X- a! H. {
function updatecredit($get, $post)
) [/ n6 S* f; k, y$ o8 g{
  d5 ]+ I5 k/ U+ S   if(!API_UPDATECREDIT)
4 d- l4 G0 @7 |7 ~   {
6 J6 l: x, e4 Y' Z    return API_RETURN_FORBIDDEN;0 _( q1 P* V( S) I, u- K1 S
   }! i7 K) r/ G( u9 m  u# J( O9 \& m
   /*' Z; s* B* z/ K& G) j. F$ H
   note 更新积分' J1 x2 _! L; b% l: g
   discuz 默认8个积分表达,而DedeCMS只有一个积分字段,scores.注意money不能做积分来用.
0 I2 j8 R) ~! G9 b8 v* \   extcredits1 extcredits2 extcredits3 extcredits4 extcredits5 extcredits6 extcredits7 extcredits8" m8 U- L2 k( K7 i1 H
   */+ b0 `  L. F; @8 s) N/ _( E* H" H3 J- A
    9 O" d9 N8 F* l" a  B+ B' a8 E9 p% w
   $credit = intval($get['credit']);6 r) T. P( o5 b9 Y- c2 E
   $fileds = $credit > 1 ? 'money' : 'scores';1 E' n+ Y3 \( o# X  `9 Q9 p
   $amount = $get['amount'];0 V( w" s6 K+ b7 c9 |* k8 t# v
   $uid = $get['uid'];9 s/ C# G& K1 [
   include UC_CLIENT_ROOT.'/client.php';
7 q5 D$ ]  Y: {; M4 M# G+ s  t   $data = uc_get_user($uid,1);
8 @) M& w, y- a' L   $username = $data[1];5 T( Q! K) c  [7 ?5 V6 J
  . l- M/ l. `) |: w
   $result = $this->db->GetOne("SELECT mid FROM
`dede_member` WHERE userid='$username'");
3 I* Q% O5 E& z   if(is_array($result))+ \/ \" L- [4 o- d" }1 \- E
   {" u9 s" x- b* L+ x
    $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `$fileds`=`$fileds`+'$amount' WHERE mid='$result[mid]'");7 L( O; `" q* A1 n/ v/ ?
   }
. Q0 q0 B# f; M6 F9 \6 a3 n. k0 m5 {  
* f  `1 C* ?4 c' @  f/ c   return API_RETURN_SUCCEED;7 S- ]  ~7 g. @! g. ~/ A0 L. E
}

( R  c7 O  W- F$ [2 H! C! sfunction getcredit($get, $post)3 M2 L+ F+ L( _& E
{# K3 q  @; n" x: B+ f; V
   if(!API_GETCREDIT)
1 s# [$ Z$ [, P0 [) ?0 b. F   {
' O, l& F( {9 L# {# u, k7 R    return API_RETURN_FORBIDDEN;* I7 p+ j! j  t5 M
   }# ~5 Z: C2 J7 b2 V, \9 @1 F
  9 i+ Z5 w& m7 [. Y& g
   include UC_CLIENT_ROOT.'/client.php';
3 ^, [$ z7 z: C4 j  M% j' d   $data = uc_get_user($uid,1);
! Z/ X6 C! y# U   $username = $data[1];
3 R  {/ r2 l& v   $credit = intval($get['credit']);. m- g, p! m8 ?4 t' c: y" e  G
   $fileds = $credit > 1 ? 'money' : 'scores';
5 `4 b' ^) j2 T( H, ?9 ?; k. E. N   $result = $this->db->GetOne("SELECT `$fileds` AS credit FROM
`dede_member` WHERE userid='$username'");9 w, q4 X$ Y. B- \
  1 E5 v6 m; v1 [! z9 p6 @: i+ j  R
   echo is_array($result) ? $result['credit'] : 0;  ) |4 v- e  E- W
}

! C+ f; O& R& }3 }function getcreditsettings($get, $post)
( x( X) L$ w* j7 w{
9 u3 i3 M. K- k& ?" F8 \   if(!API_GETCREDITSETTINGS): Q. f# i+ p8 T6 T+ o
   {
9 S3 Q4 z" n' C' p$ S- ?    return API_RETURN_FORBIDDEN;2 s2 s2 s" `5 h1 p
   }" x. t6 v; k$ v/ I* {
  * F# R7 ]7 B1 `! K- S1 s) o0 X. e( m0 t
   //这里支持DedeCMS积分,金币设置! K, {; u" G5 s6 O5 @- w" e% l
   $credits[1] = array(strip_tags('积分'), '分');
: W" k1 ~* e2 v   $credits[2] = array(strip_tags('金币'), '枚');5 o/ Y) u- u* l  S% s* S
   return $this->_serialize($credits);' _, ]3 Z. e6 ~* j+ R
}

$ R. Q: U1 o0 a% kfunction updatecreditsettings($get, $post)# Q& @" n( ]9 F7 H& X6 O( |9 {
{0 B# c! v0 K: h+ _0 B& K( q
   if(!API_UPDATECREDITSETTINGS)
) K+ n  C1 |# a4 F   {: t* F+ p1 ]$ |. W0 a2 P" K( C, ^
    return API_RETURN_FORBIDDEN;1 |$ Q" |+ d! Y, Q/ J/ P0 T6 @
   }! G. o+ y6 e2 n4 L
   $credit = $get['credit'];
, U) [5 @. I0 w! H# n$ Q   $outextcredits = array();3 Q) K/ g5 @! H" T& E0 t
   if($credit && is_array($credit)) {8 g  F( N7 [  R* O1 m/ r* H
    foreach($credit as $appid => $credititems) {; w1 _# {. W+ g- U, \/ s
     foreach($credititems as $value) {- y6 V0 \9 i) F: G1 j
      if($value['appiddesc']!=UC_APPID) continue;
& m) L$ l% q- U5 G      $outextcredits[$appid][] = array(
. H/ f) O8 e: g. Z2 Q0 a       'appiddesc' => $value['appiddesc'],
2 R- }. d2 m% ~% t: L8 @( X       'creditdesc' => $value['creditdesc'],
1 k0 ]/ k  e. D) W1 d: }; M       'creditsrc' => $value['creditsrc'],* i6 c3 C* w4 T
       'title' => $value['title'],. e4 _. ]% Y0 m  Z
       'unit' => $value['unit'],
1 k; Q4 d; j9 X       'ratiosrc' => $value['ratiosrc'],0 _3 C1 k1 Z4 f, D
       'ratiodesc' => $value['ratiodesc'],* j. n0 P4 @1 Y  u0 E" }# k8 G) y: x' c
       'ratio' => $value['ratio']
) R$ T4 X( n2 j6 P+ T8 `      );
, c9 r" z2 h* N0 Q% m  L' b5 e     }) D# f7 q$ o3 N
    }# I8 h7 S7 w  Z! j3 a
   }# s* O$ o; _: M5 Q* K2 N: T
   $_CACHE = "<?php !defined('UC_API') && exit("403  Forbidden!");n".'$_CACHE['credit'] =  unserialize("'.addslashes(serialize($outextcredits)).'");'."rn".'?>';
# \# C" x* M8 G. U" d, E8 `   $fp = @fopen(DEDEDATA.'/credits.inc.php', 'w');
  `- j7 B7 f- b   @fwrite($fp, $_CACHE);3 [3 B- H# N3 a
   @fclose($fp);4 ?4 ?7 C6 d3 m. Y1 E% a0 B3 Y
   return API_RETURN_SUCCEED;
1 i* {: ^  f. g1 t& B7 m1 Y}  h! J, B+ r9 D9 Z" A1 p
}
; y3 R2 X8 T* N5 Q

' o/ C; X' k; B7 ?! `3 `3 G6 Zfunction _authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
6 I7 p1 ~  y( f# }5 X7 R$ckey_length = 4;

% v8 \) a# N6 t  B# N! |$key = md5($key ? $key : UC_KEY);
3 E. C  {& h9 _. `2 }( Y$keya = md5(substr($key, 0, 16));; ?; w# ^8 o& {" }" u; _9 r& O
$keyb = md5(substr($key, 16, 16));# [4 D! r3 M; p  J
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0,  $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

) a. G7 {8 O+ p5 f5 J1 `; D8 O( e5 z$cryptkey = $keya.md5($keya.$keyc);6 i+ I2 d- r" F/ H! {
$key_length = strlen($cryptkey);

2 Y5 a: o3 [  E3 P$string = $operation == 'DECODE' ?  base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ?  $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
8 S4 e. M5 ^( E$string_length = strlen($string);

2 }( i# l; h' X/ ?$result = '';1 S" j2 w% p/ a. A' S, f
$box = range(0, 255);
0 y5 \5 i( O( L# V* |: B
$rndkey = array();
# |7 }7 v" t$ V+ b9 R4 jfor($i = 0; $i <= 255; $i++) {" X. ?$ y' \; n% y# N( c
   $rndkey[$i] = ord($cryptkey[$i % $key_length]);8 n. e7 a0 |- f+ N0 ~
}

& U* G$ f( ]4 L7 x0 p: Sfor($j = $i = 0; $i < 256; $i++) {$ M) Z/ S9 \7 N& H8 a$ T
   $j = ($j + $box[$i] + $rndkey[$i]) % 256;1 @* |# A" U9 n% r# t
   $tmp = $box[$i];* `6 _6 q& |" Q1 r# u
   $box[$i] = $box[$j];
0 C% `7 z  \7 p0 T1 T   $box[$j] = $tmp;
2 b: Y" S  i3 `& L}

$ Q5 l! {, j, U2 ?9 tfor($a = $j = $i = 0; $i < $string_length; $i++) {
3 K, c) k* p: D- [- [4 P5 {2 F   $a = ($a + 1) % 256;4 N$ ?# L% K5 C0 R9 L2 X4 {) A/ q7 _* R% z
   $j = ($j + $box[$a]) % 256;/ j- K! f1 J9 U" h* L3 ?; X7 b$ @
   $tmp = $box[$a];7 |+ f, O3 I- ]) f7 h  p, Z% Y
   $box[$a] = $box[$j];
4 }- D6 R/ _; m; G  g9 Q   $box[$j] = $tmp;) P6 \0 |  k7 l1 I$ z& e8 g
   $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
0 m2 d- U% y. M5 A}
$ @7 f6 c7 B. F5 R: o& Z0 V$ [
if($operation == 'DECODE') {
$ Y: A3 l$ J* ]. N4 \   if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time()  > 0) && substr($result, 10, 16) == substr(md5(substr($result,  26).$keyb), 0, 16)) {) z5 g- q5 R8 _. L. b, c
    return substr($result, 26);- N$ y# G* h* ^2 X9 E, F
   } else {: F3 Q2 k4 @7 [3 {9 D" r, w2 ~0 p
     return '';
9 L6 a. g' N0 A8 I; ~5 L5 `/ {) R    }3 D8 g5 D/ V  c
} else {* p( m# o) a; w; w" B1 o/ l! ^
   return $keyc.str_replace('=', '', base64_encode($result));
! @7 j: H2 W2 j6 L4 ]}
  X! r; J) ^. H, v; }6 q
}4 r4 A* C( g+ Y- E+ O
function _stripslashes($string) {
% V. _. B6 D, }. X; Sif(is_array($string)) {+ W' C$ j6 h, x
   foreach($string as $key => $val) {3 t2 k0 c) O# I# M, G
    $string[$key] = _stripslashes($val);- P. E* b: A  M  h, ?
   }- {7 Q$ a" o$ K0 Y3 j. n  J* n& q
} else {: U5 }9 D/ D& Q2 g8 K5 z9 }
   $string = stripslashes($string);
( h/ L* C  h2 `- o( {. i1 m. M" r}7 O6 s; L5 l( G0 U. Y4 k! x  \& b
return $string;$ l) A& ?& c, C' P2 f) F
}
. X; q% U/ L/ M/ X
?>: b$ e0 M  Z. j
0 p2 A8 M0 g% M
# b9 d( |9 y: u/ |, w1 x
            

qiuqiufa.com

网站简介

球球发,是一家 Discuz! 商业插件、风格模板、网站源码、 Discuz!运营维护技术等于一体的交流分享网站,全站95%的资源都是免费下载,对于资源我们是每天更新,每个亲测资源最新最全---球球发(如果我们有侵犯了您权益的资源请联系我们删除