function _register($register) { $this->_bbsUrl =& $register['bbsUrl']; $this->_job =& $register['job']; $this->_objectId =& $register['objectid']; $this->_optionId =& $register['optionid']; $this->_typeId =& $register['typeid']; $this->_action =& $register['action']; $this->_pwServer =& $register['pwServer']; $this->_uid =& $register['uid']; $this->_elementid =& $register['elementid']; $this->_authorid =& $register['authorid']; $this->_groupId =& $register['groupId']; $this->_db_ratepower =& $register['db_ratepower']; $this->_db_rategroup =& $register['db_rategroup']; $this->_ip = pwGetIp(); $this->_noAjax =& $register['noAjax']; $this->_db_hackdb =& $register['db_hackdb']; }
* * Copyright (c) 2003-09 PHPWind.net. All rights reserved. * Support : http://www.phpwind.net * This software is the proprietary information of PHPWind.com. * */ !defined('R_P') && exit('Forbidden'); define('P_W', 'admincp'); define('UC_CLIENT_ROOT', R_P . '/uc_client/'); function_exists('date_default_timezone_set') && date_default_timezone_set('Etc/GMT+0'); require_once R_P . 'require/common.php'; pwInitGlobals(); include_once D_P . 'data/bbscache/config.php'; $timestamp = time(); $db_cvtime != 0 && ($timestamp += $db_cvtime * 60); $onlineip = pwGetIp(); $db_cc && pwDefendCc($db_cc); $ceversion = defined('CE') ? 1 : 0; #PHPWind version list($wind_version, $wind_repair, $wind_from) = explode(',', WIND_VERSION); InitGP(array('adminjob', 'admintype', 'type', 'hackset', 'a_type', 'action', 'verify', 'adskin', 'job', 'ajax', 'admin_keyword')); if (strpos($adminjob, '..') !== false || $admintype && strpos($admintype, '..') !== false) { exit('Forbidden'); } isset($_GET['adskin']) && ($adskin = GetGP('adskin')); isset($adskin) ? Cookie('adskin', $adskin) : ($adskin = GetCookie('adskin')); if ($ajax) { define('AJAX', '1'); } if ($db_forcecharset && !defined('AJAX')) { @header("Content-Type:text/html; charset={$db_charset}");
function post($fid, $author, $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, $db_ipban; L::loadClass('forum', 'forum', false); $pwforum = new PwForum($fid); if (!$pwforum->isForum()) { return new ApiResponse('API_THREAD_FORUM_NOT_EXISTS'); //return new ErrorMsg(API_THREAD_FORUM_NOT_EXISTS, 'Forum not exists'); } $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $winddb = $userService->getByUserName($author, true, true); if (empty($winddb)) { return new ApiResponse('API_THREAD_AUTHOR_NOT_EXISTS'); //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 ($groupid == 6 || getstatus($winddb['userstatus'], PW_USERSTATUS_BANUSER)) { //会员禁言 return new ApiResponse('API_THREAD_THE_USER_BAN'); } //检查是否有html发帖权限 没有的话返回提示信息 $htmlright = $this->db->get_value("SELECT rvalue FROM pw_permission WHERE uid='0' AND fid='0' AND rkey='htmlcode' AND gid=" . S::sqlEscape($groupid)); if ($htmlright == '0') { return new ApiResponse('API_THREAD_NO_HTMLRIGHT'); } if ($db_ipban) { //IP禁止 $onlineip = pwGetIp(); $baniparray = explode(',', $db_ipban); foreach ($baniparray as $banip) { if ($banip && strpos(",{$onlineip}.", ',' . trim($banip) . '.') !== false) { return new ApiResponse('API_THREAD_THE_IP_BAN'); } } } 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('topicpost', 'forum', false); $topicpost = new topicPost($pwpost); $topicpost->check(); $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)); //* include_once pwCache::getPath(D_P.'data/bbscache/forum_typecache.php'); extract(pwCache::getData(D_P . 'data/bbscache/forum_typecache.php', false)); $t_db = $topic_type_cache[$fid]; $postdata->setWtype($p_type, $p_sub_type, 1, $t_db); $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))) { return new ApiResponse($msg); //$errmsg = $this->getErrMsg($msg); //return new ErrorMsg($errmsg[0], $errmsg[1]); } $topicpost->execute($postdata); $tid = $topicpost->getNewId(); return new ApiResponse($tid); }