function postModify($tid, $fid, $uid, $title, $content, $tags = '', $convert = 1, $usesign = 1, $usehtml = 0, $topped = 0, $digest = 0, $p_type = '', $p_sub_type = '') { global $winddb, $winduid, $windid, $groupid, $_G, $SYSTEM, $timestamp; require_once R_P . 'lib/forum.class.php'; $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { return new ErrorMsg(API_THREAD_FORUM_NOT_EXISTS, 'Forum not exists'); } $winddb = $this->db->get_one("SELECT m.uid,m.username,m.password,m.safecv,m.email,m.oicq,m.groupid,m.memberid,m.groups,m.icon,m.regdate,m.honor,m.timedf,m.style,m.datefm,m.t_num,m.p_num,m.yz,m.newpm,m.userstatus,m.shortcut,md.postnum,md.rvrc,md.money,md.credit,md.currency,md.lastvisit,md.thisvisit,md.onlinetime,md.lastpost,md.todaypost,md.monthpost,md.onlineip,md.uploadtime,md.uploadnum,md.starttime,md.pwdctime,md.monoltime,md.digests,md.f_num,md.creditpop FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid WHERE m.uid=" . pwEscape($uid)); if (empty($winddb)) { return new ErrorMsg(API_THREAD_AUTHOR_NOT_EXISTS, 'User not exists'); } $winduid = $winddb['uid']; $groupid = $winddb['groupid']; $windid = $winddb['username']; $groupid == '-1' && ($groupid = $winddb['memberid']); if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) { include Pcv(D_P . "data/groupdb/group_{$groupid}.php"); } else { include D_P . 'data/groupdb/group_1.php'; } require_once R_P . 'lib/post.class.php'; require_once R_P . 'require/bbscode.php'; $pwpost = new PwPost($pwforum); $pwpost->errMode = true; require_once R_P . 'lib/postmodify.class.php'; $postmodify = new topicModify($tid, 0, $pwpost); $atcdb = $postmodify->init(); if (empty($atcdb) || $atcdb['fid'] != $fid) { return new ErrorMsg(API_THREAD_ILLEGAL_TID, 'The tid is illegal'); } if ($winduid != $atcdb['authorid'] && $groupid != 3 && $groupid != 4) { $authordb = $this->db->get_one("SELECT groupid FROM pw_members WHERE uid=" . pwEscape($atcdb['authorid'])); if ($authordb['groupid'] == 3 || $authordb['groupid'] == 4) { return new ErrorMsg(API_THREAD_MODIFY_ADMIN, 'The tid is not modify'); } } if ($_G['edittime'] && $timestamp - $atcdb['postdate'] > $_G['edittime'] * 60) { return new ErrorMsg(API_THREAD_MODIFY_TIMELIMIT, 'The modify time limit'); } $postdata = new topicPostData($pwpost); include_once D_P . 'data/bbscache/cache_post.php'; $t_db = $topic_type_cache[$fid]; $postdata->setWtype($p_type, $p_sub_type, 0, $t_db); $postdata->initData($postmodify); $postdata->setTitle($title); $postdata->setContent($content); $postdata->setConvert($convert, 1); $postdata->setTags($tags); $postdata->setDigest($digest); $postdata->setTopped($topped); $postdata->setIfsign($usesign, $usehtml); if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) { $errmsg = $this->getErrMsg($msg); return new ErrorMsg($errmsg[0], $errmsg[1]); } $postmodify->execute($postdata); return new ApiResponse(true); }
$t_exits = 1; } } if ($t_subtypedb) { $t_subtypedb = pwJsonEncode($t_subtypedb); $t_sub_exits = 1; } */ $t_per = $pwforum->foruminfo['t_type']; $db_forcetype = $t_db && $t_per == '2' && $article == 0 && !$pwpost->admincheck ? 1 : 0; // 是否需要强制主题分类 require_once R_P . 'lib/postmodify.class.php'; if ($pid && is_numeric($pid)) { $postmodify = new replyModify($tid, $pid, $pwpost); } else { $postmodify = new topicModify($tid, 0, $pwpost); } $atcdb = $postmodify->init(); if (empty($atcdb) || $atcdb['fid'] != $fid) { Showmsg('illegal_tid'); } if ($postmodify->type == 'topic') { $ifmailck = $atcdb['ifmail'] > 1 ? 'checked' : ''; list($magicid, $magicname) = explode("\t", $atcdb['magic']); $type = $atcdb['type']; $special = $atcdb['special']; $modelid = $atcdb['modelid']; $pcid = $atcdb['special'] > 20 ? $atcdb['special'] - 20 : 0; $isCheck_hiddenPost = $atcdb['shares'] ? "checked" : ""; $isCheck_anonymous = $atcdb['anonymous'] ? "checked" : ""; } else {
function postModify($tid, $fid, $uid, $title, $content, $tags = '', $convert = 1, $usesign = 1, $usehtml = 0, $topped = 0, $digest = 0, $p_type = '', $p_sub_type = '') { global $winddb, $winduid, $windid, $groupid, $_G, $SYSTEM, $timestamp; L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { return new ErrorMsg(API_THREAD_FORUM_NOT_EXISTS, 'Forum not exists'); } $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $winddb = $userService->get($uid, true, true); if (empty($winddb)) { return new ErrorMsg(API_THREAD_AUTHOR_NOT_EXISTS, 'User not exists'); } $winduid = $winddb['uid']; $groupid = $winddb['groupid']; $windid = $winddb['username']; $groupid == '-1' && ($groupid = $winddb['memberid']); if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) { //* include pwCache::getPath(S::escapePath(D_P."data/groupdb/group_$groupid.php")); extract(pwCache::getData(S::escapePath(D_P . "data/groupdb/group_{$groupid}.php", false))); } else { //* include pwCache::getPath(D_P.'data/groupdb/group_1.php'); extract(pwCache::getData(D_P . 'data/groupdb/group_1.php', false)); } L::loadClass('post', 'forum', false); require_once R_P . 'require/bbscode.php'; $pwpost = new PwPost($pwforum); $pwpost->errMode = true; L::loadClass('postmodify', 'forum', false); $postmodify = new topicModify($tid, 0, $pwpost); $atcdb = $postmodify->init(); if (empty($atcdb) || $atcdb['fid'] != $fid) { return new ErrorMsg(API_THREAD_ILLEGAL_TID, 'The tid is illegal'); } if ($winduid != $atcdb['authorid'] && $groupid != 3 && $groupid != 4) { $authordb = $userService->get($atcdb['authorid']); /**Begin modify by liaohu*/ $pce_arr = explode(",", $GLOBALS['SYSTEM']['tcanedit']); if (($authordb['groupid'] == 3 || $authordb['groupid'] == 4 || $authordb['groupid'] == 5) && !in_array($authordb['groupid'], $pce_arr)) { return new ErrorMsg(API_THREAD_MODIFY_ADMIN, 'The tid is not modify'); } /*if (($authordb['groupid'] == 3 || $authordb['groupid'] == 4)) { return new ErrorMsg(API_THREAD_MODIFY_ADMIN, 'The tid is not modify'); }*/ /**End modify by liaohu*/ } if ($_G['edittime'] && $timestamp - $atcdb['postdate'] > $_G['edittime'] * 60) { return new ErrorMsg(API_THREAD_MODIFY_TIMELIMIT, 'The modify time limit'); } $postdata = new topicPostData($pwpost); //* include_once pwCache::getPath(D_P.'data/bbscache/cache_post.php'); extract(pwCache::getData(D_P . 'data/bbscache/cache_post.php', false)); $t_db = $topic_type_cache[$fid]; $postdata->setWtype($p_type, $p_sub_type, 0, $t_db); $postdata->initData($postmodify); $postdata->setTitle($title); $postdata->setContent($content); $postdata->setConvert($convert, 1); $postdata->setTags($tags); $postdata->setDigest($digest); $postdata->setTopped($topped); $postdata->setIfsign($usesign, $usehtml); if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) { $errmsg = $this->getErrMsg($msg); return new ErrorMsg($errmsg[0], $errmsg[1]); } $postmodify->execute($postdata); return new ApiResponse(true); }