function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $censor = 0, $bbcode = 0, $html = 0) { global $_G; $string = trim($string); if ($in_slashes) { $string = dstripslashes($string); } if ($html < 0) { $string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string); } elseif ($html == 0) { $string = dhtmlspecialchars($string); } if ($censor) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } $censor = discuz_censor::instance(); $censor->check($string); if ($censor->modbanned() || $censor->modmoderated()) { showmessage('word_banned'); } } if ($length) { $string = cutstr($string, $length); } if ($bbcode) { require_once DISCUZ_ROOT . './source/class/class_bbcode.php'; $bb =& bbcode::instance(); $string = $bb->bbcode2html($string, $bbcode); } if ($out_slashes) { $string = daddslashes($string); } return trim($string); }
function censormod($message) { require_once libfile('class/censor'); $censor = discuz_censor::instance(); $censor->check($message); return $censor->modmoderated(); }
function censormod($message) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } $censor = discuz_censor::instance(); $censor->check($message); if ($censor->modmoderated()) { return TRUE; } return FALSE; }
} $allowcstatus = !empty($_G['group']['allowcstatus']) ? true : false; $verify = DB::fetch_first("SELECT * FROM " . DB::table("common_member_verify") . " WHERE uid='{$_G['uid']}'"); $validate = array(); if ($_G['setting']['regverify'] == 2 && $_G['groupid'] == 8) { $validate = DB::fetch_first("SELECT * FROM " . DB::table('common_member_validate') . " WHERE uid='{$_G['uid']}' AND status='1'"); } $conisregister = $operation == 'password' && $_G['setting']['connect']['allow'] && DB::result_first("SELECT conisregister FROM " . DB::table('common_member_connect') . " WHERE uid='{$_G['uid']}'"); if (submitcheck('profilesubmit')) { require_once libfile('function/discuzcode'); $forum = $setarr = $verifyarr = $errorarr = array(); $forumfield = array('customstatus', 'sightml'); if (!class_exists('discuz_censor')) { include libfile('class/censor'); } $censor = discuz_censor::instance(); if ($_G['gp_vid']) { $vid = intval($_G['gp_vid']); $verifyconfig = $_G['setting']['verify'][$vid]; if ($verifyconfig['available']) { $verifyinfo = DB::fetch_first("SELECT * FROM " . DB::table("common_member_verify_info") . " WHERE uid='{$_G['uid']}' AND verifytype='{$vid}'"); if (!empty($verifyinfo)) { $verifyinfo['field'] = unserialize($verifyinfo['field']); } foreach ($verifyconfig['field'] as $key => $field) { if (!isset($verifyinfo['field'][$key])) { $verifyinfo['field'][$key] = $key; } } } else { $vid = 0;
public static function censormod($message) { global $_G; if ($_G['group']['ignorecensor']) { return false; } $modposturl = false; if ($_G['group']['allowposturl'] == 1) { $urllist = self::get_url_list($message); if (is_array($urllist[1])) { foreach ($urllist[1] as $key => $val) { if (!($val = trim($val))) { continue; } if (!iswhitelist($val)) { $modposturl = true; } } } } if ($modposturl) { return true; } $censor = discuz_censor::instance(); $censor->check($message); return $censor->modmoderated(); }
private function _applyActivityTopic($res, $tid, $uid, $data) { // from forum_misc.php require_once libfile('function/post'); $activity = DzForumActivity::getActivityByTid($tid); if ($activity['expiration'] && $activity['expiration'] < TIMESTAMP) { return $this->_makeErrorInfo($res, 'activity_stop'); } $applyinfo = DzForumActivityApply::getApplyByTidUid($tid, $uid); if ($applyinfo && $applyinfo['verified'] < DzForumActivityApply::STATUS_VERIFIED_IMPROVE) { return $this->_makeErrorInfo($res, 'activity_repeat_apply'); } global $_G; $_GET = $data; $thread = ForumUtils::getTopicInfo($tid); $payvalue = intval($_GET['payvalue']); $payment = $_GET['payment'] ? $payvalue : -1; $message = cutstr(dhtmlspecialchars($_GET['message']), 200); $verified = $thread['authorid'] == $uid ? 1 : 0; $ufielddata = ''; if ($activity['ufield']) { $ufielddata = array(); $version = MobcentDiscuz::getMobcentDiscuzVersion(); $activity['ufield'] = $version != MobcentDiscuz::VERSION_X20 ? dunserialize($activity['ufield']) : unserialize($activity['ufield']); if (!empty($activity['ufield']['userfield'])) { if ($version == MobcentDiscuz::VERSION_X20) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } } $censor = discuz_censor::instance(); loadcache('profilesetting'); foreach ($data as $key => $value) { if (empty($_G['cache']['profilesetting'][$key])) { continue; } if (is_array($value)) { $value = implode(',', $value); } $value = cutstr(dhtmlspecialchars(trim($value)), 100, '.'); // if ($_G['cache']['profilesetting'][$key]['formtype'] == 'file' && !preg_match("/^https?:\/\/(.*)?\.(jpg|png|gif|jpeg|bmp)$/i", $value)) { // showmessage('activity_imgurl_error'); // } if (empty($value) && $key != 'residedist' && $key != 'residecommunity') { return $this->_makeErrorInfo($res, 'activity_exile_field'); } $ufielddata['userfield'][$key] = $value; } } if (!empty($activity['ufield']['extfield'])) { foreach ($activity['ufield']['extfield'] as $fieldid) { $value = cutstr(dhtmlspecialchars(trim($_GET['' . $fieldid])), 50, '.'); $ufielddata['extfield'][$fieldid] = $value; } } $ufielddata = !empty($ufielddata) ? serialize($ufielddata) : ''; } if ($_G['setting']['activitycredit'] && $activity['credit'] && empty($applyinfo['verified'])) { checklowerlimit(array('extcredits' . $_G['setting']['activitycredit'] => '-' . $activity['credit'])); updatemembercount($uid, array($_G['setting']['activitycredit'] => '-' . $activity['credit']), true, 'ACC', $tid); } $data = array('tid' => $tid, 'username' => $_G['username'], 'uid' => $uid, 'message' => $message, 'verified' => $verified, 'dateline' => $_G['timestamp'], 'payment' => $payment, 'ufielddata' => $ufielddata); if ($applyinfo && $applyinfo['verified'] == DzForumActivityApply::STATUS_VERIFIED_IMPROVE) { DzForumActivityApply::updateApplyById($data, $applyinfo['applyid']); } else { DzForumActivityApply::insertApply($data); } DzForumActivity::updateApplyNumberByTid($tid); if ($thread['authorid'] != $uid) { notification_add($thread['authorid'], 'activity', 'activity_notice', array('tid' => $tid, 'subject' => $thread['subject'])); $space = array(); space_merge($space, 'field_home'); if (!empty($space['privacy']['feed']['newreply'])) { $feed['icon'] = 'activity'; $feed['title_template'] = 'feed_reply_activity_title'; $feed['title_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$thread['subject']}</a>", 'hash_data' => "tid{$tid}"); $feed['id'] = $tid; $feed['idtype'] = 'tid'; postfeed($feed); } } $res = $this->_makeErrorInfo($res, 'activity_completion'); $res['rs'] = 1; return $res; }
function censor($message, $modword = NULL) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } $censor = discuz_censor::instance(); $censor->check($message, $modword); if ($censor->modbanned()) { showmessage('word_banned'); } return $message; }
function censor($message, $modword = NULL) { require_once libfile('class/censor'); $censor = discuz_censor::instance(); $censor->check($message, $modword); if ($censor->modbanned()) { $wordbanned = implode(', ', $censor->words_found); showmessage('word_banned', '', array('wordbanned' => $wordbanned)); } return $message; }
private function _adminUserInfo($act) { global $_G; $defaultop = ''; $profilegroup = C::t('common_setting')->fetch('profilegroup', true); foreach ($profilegroup as $key => $value) { if ($value['available']) { $defaultop = $key; break; } } $errorMsg = ''; $operation = $act; require_once libfile('function/editor'); include_once libfile('function/profile'); $space = getuserbyuid($_G['uid']); space_merge($space, 'profile'); space_merge($space, 'field_home'); space_merge($space, 'field_forum'); $space['sightml'] = html2bbcode($space['sightml']); $vid = $_GET['vid'] ? intval($_GET['vid']) : 0; $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array(); $_G['setting']['privacy'] = $_G['setting']['privacy'] ? $_G['setting']['privacy'] : array(); $_G['setting']['privacy'] = is_array($_G['setting']['privacy']) ? $_G['setting']['privacy'] : dunserialize($_G['setting']['privacy']); $_G['setting']['privacy']['profile'] = !empty($_G['setting']['privacy']['profile']) ? $_G['setting']['privacy']['profile'] : array(); $privacy = array_merge($_G['setting']['privacy']['profile'], $privacy); $actives = array('profile' => ' class="a"'); $opactives = array($operation => ' class="a"'); $allowitems = array(); $allowitems = $profilegroup[$operation]['field']; $showbtn = $vid && $verify['verify' . $vid] != 1 || empty($vid); if (!empty($verify) && is_array($verify)) { foreach ($verify as $key => $flag) { if (in_array($key, array('verify1', 'verify2', 'verify3', 'verify4', 'verify5', 'verify6', 'verify7')) && $flag == 1) { $verifyid = intval(substr($key, -1, 1)); if ($_G['setting']['verify'][$verifyid]['available']) { foreach ($_G['setting']['verify'][$verifyid]['field'] as $field) { $_G['cache']['profilesetting'][$field]['unchangeable'] = 1; } } } } } if ($vid) { if ($value = C::t('common_member_verify_info')->fetch_by_uid_verifytype($_G['uid'], $vid)) { $field = dunserialize($value['field']); foreach ($field as $key => $fvalue) { $space[$key] = $fvalue; } } } $htmls = $settings = array(); foreach ($allowitems as $fieldid) { if (!in_array($fieldid, array('sightml', 'customstatus', 'timeoffset'))) { $html = profile_setting($fieldid, $space, $vid ? false : true); if ($html) { $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid]; $htmls[$fieldid] = $html; } } } if (!empty($_POST)) { require_once libfile('function/discuzcode'); $forum = $setarr = $verifyarr = $errorarr = array(); $forumfield = array('customstatus', 'sightml'); $censor = discuz_censor::instance(); if ($_GET['vid']) { $vid = intval($_GET['vid']); $verifyconfig = $_G['setting']['verify'][$vid]; if ($verifyconfig['available'] && (empty($verifyconfig['groupid']) || in_array($_G['groupid'], $verifyconfig['groupid']))) { $verifyinfo = C::t('common_member_verify_info')->fetch_by_uid_verifytype($_G['uid'], $vid); if (!empty($verifyinfo)) { $verifyinfo['field'] = dunserialize($verifyinfo['field']); } foreach ($verifyconfig['field'] as $key => $field) { if (!isset($verifyinfo['field'][$key])) { $verifyinfo['field'][$key] = $key; } } } else { $_GET['vid'] = $vid = 0; $verifyconfig = array(); } } if (isset($_POST['birthprovince'])) { $initcity = array('birthprovince', 'birthcity', 'birthdist', 'birthcommunity'); foreach ($initcity as $key) { $_GET['' . $key] = $_POST[$key] = !empty($_POST[$key]) ? $_POST[$key] : ''; } } if (isset($_POST['resideprovince'])) { $initcity = array('resideprovince', 'residecity', 'residedist', 'residecommunity'); foreach ($initcity as $key) { $_GET['' . $key] = $_POST[$key] = !empty($_POST[$key]) ? $_POST[$key] : ''; } } foreach ($_POST as $key => $value) { $field = $_G['cache']['profilesetting'][$key]; if (in_array($field['formtype'], array('text', 'textarea')) || in_array($key, $forumfield)) { $censor->check($value); if ($censor->modbanned() || $censor->modmoderated()) { $list = $this->makeErrorInfo($res, 'profile_censor'); $this->_exitWithHtmlAlert($list['errcode']); // profile_showerror($key, lang('spacecp', 'profile_censor')); } } if (in_array($key, $forumfield)) { if ($key == 'sightml') { loadcache(array('smilies', 'smileytypes')); $value = cutstr($value, $_G['group']['maxsigsize'], ''); foreach ($_G['cache']['smilies']['replacearray'] as $skey => $smiley) { $_G['cache']['smilies']['replacearray'][$skey] = '[img]' . $_G['siteurl'] . 'static/image/smiley/' . $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$skey]]['directory'] . '/' . $smiley . '[/img]'; } $value = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], trim($value)); $forum[$key] = discuzcode($value, 1, 0, 0, 0, $_G['group']['allowsigbbcode'], $_G['group']['allowsigimgcode'], 0, 0, 1); } elseif ($key == 'customstatus' && $allowcstatus) { $forum[$key] = dhtmlspecialchars(trim($value)); } continue; } elseif ($field && !$field['available']) { continue; } elseif ($key == 'timeoffset') { if ($value >= -12 && $value <= 12 || $value == 9999) { C::t('common_member')->update($_G['uid'], array('timeoffset' => intval($value))); } } elseif ($key == 'site') { if (!in_array(strtolower(substr($value, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\\//', $value) && !preg_match('/^data\\//', $value)) { $value = 'http://' . $value; } } if ($field['formtype'] == 'file') { if (!empty($_FILES[$key]) && $_FILES[$key]['error'] == 0 || !empty($space[$key]) && empty($_GET['deletefile'][$key])) { $value = '1'; } else { $value = ''; } } if (empty($field)) { continue; } elseif (profile_check($key, $value, $space)) { $setarr[$key] = dhtmlspecialchars(trim($value)); } else { if ($key == 'birthprovince') { $key = 'birthcity'; } elseif ($key == 'resideprovince' || $key == 'residecommunity' || $key == 'residedist') { $key = 'residecity'; } elseif ($key == 'birthyear' || $key == 'birthmonth') { $key = 'birthday'; } // profile_showerror($key); $list = $this->makeErrorInfo($res, 'check_date_item'); $errcode = $list['errcode'] . $settings[$key]['title']; $this->_exitWithHtmlAlert($errcode); } if ($field['formtype'] == 'file') { unset($setarr[$key]); } if ($vid && $verifyconfig['available'] && isset($verifyconfig['field'][$key])) { if (isset($verifyinfo['field'][$key]) && $setarr[$key] !== $space[$key]) { $verifyarr[$key] = $setarr[$key]; } unset($setarr[$key]); } if (isset($setarr[$key]) && $_G['cache']['profilesetting'][$key]['needverify']) { if ($setarr[$key] !== $space[$key]) { $verifyarr[$key] = $setarr[$key]; } unset($setarr[$key]); } } if ($vid && !empty($verifyinfo['field']) && is_array($verifyinfo['field'])) { foreach ($verifyinfo['field'] as $key => $fvalue) { if (!isset($verifyconfig['field'][$key])) { unset($verifyinfo['field'][$key]); continue; } if (empty($verifyarr[$key]) && !isset($verifyarr[$key]) && isset($verifyinfo['field'][$key])) { $verifyarr[$key] = !empty($fvalue) && $key != $fvalue ? $fvalue : $space[$key]; } } } if ($forum) { if (!$_G['group']['maxsigsize']) { $forum['sightml'] = ''; } C::t('common_member_field_forum')->update($_G['uid'], $forum); } if (isset($_POST['birthmonth']) && ($space['birthmonth'] != $_POST['birthmonth'] || $space['birthday'] != $_POST['birthday'])) { $setarr['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']); } if (isset($_POST['birthyear']) && $space['birthyear'] != $_POST['birthyear']) { $setarr['zodiac'] = get_zodiac($_POST['birthyear']); } if ($setarr) { C::t('common_member_profile')->update($_G['uid'], $setarr); } if ($verifyarr) { C::t('common_member_verify_info')->delete_by_uid($_G['uid'], $vid); $setverify = array('uid' => $_G['uid'], 'username' => $_G['username'], 'verifytype' => $vid, 'field' => serialize($verifyarr), 'dateline' => $_G['timestamp']); C::t('common_member_verify_info')->insert($setverify); if (!C::t('common_member_verify')->count_by_uid($_G['uid'])) { C::t('common_member_verify')->insert(array('uid' => $_G['uid'])); } if ($_G['setting']['verify'][$vid]['available']) { manage_addnotify('verify_' . $vid, 0, array('langkey' => 'manage_verify_field', 'verifyname' => $_G['setting']['verify'][$vid]['title'], 'doid' => $vid)); } } if (isset($_POST['privacy'])) { foreach ($_POST['privacy'] as $key => $value) { if (isset($_G['cache']['profilesetting'][$key])) { $space['privacy']['profile'][$key] = intval($value); } } C::t('common_member_field_home')->update($space['uid'], array('privacy' => serialize($space['privacy']))); } manyoulog('user', $_G['uid'], 'update'); include_once libfile('function/feed'); feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile')); countprofileprogress(); // $message = $vid ? lang('spacecp', 'profile_verify_verifying', array('verify' => $verifyconfig['title'])) : ''; $list = $this->makeErrorInfo($res, 'update_date_success'); $this->_exitWithHtmlAlert($list['errcode']); } $this->getController()->renderPartial('userInfoAdmin', array('formUrl' => WebUtils::createUrl_oldVersion('user/userinfoadminview', array('act' => $act)), 'errorMsg' => $errorMsg, 'action' => $act, '_G' => $_G, 'htmls' => $htmls, 'settings' => $settings)); }
function censormod($message) { global $_G; if ($_G['group']['ignorecensor']) { return false; } require_once libfile('class/censor'); $censor = discuz_censor::instance(); $censor->check($message); return $censor->modmoderated(); }