本文整理汇总了PHP中cutstr函数的典型用法代码示例。如果您正苦于以下问题:PHP cutstr函数的具体用法?PHP cutstr怎么用?PHP cutstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cutstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getstr
function getstr($string, $length, $in_slashes = 0, $out_slashes = 0, $bbcode = 0, $html = 0)
{
global $_G;
$string = trim($string);
$sppos = strpos($string, chr(0) . chr(0) . chr(0));
if ($sppos !== false) {
$string = substr($string, 0, $sppos);
}
if ($in_slashes) {
$string = dstripslashes($string);
}
$string = preg_replace("/\\[hide=?\\d*\\](.*?)\\[\\/hide\\]/is", '', $string);
if ($html < 0) {
$string = preg_replace("/(\\<[^\\<]*\\>|\r|\n|\\s|\\[.+?\\])/is", ' ', $string);
} elseif ($html == 0) {
$string = dhtmlspecialchars($string);
}
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);
}
示例2: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
$uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
$aids = !empty($parameter['aids']) ? explode(',', $parameter['aids']) : array();
$catid = !empty($parameter['catid']) ? $parameter['catid'] : array();
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'], array('dateline', 'picnum', 'updatetime')) ? $parameter['orderby'] : 'dateline';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$list = array();
$wheres = array();
if ($aids) {
$wheres[] = 'albumid IN (' . dimplode($aids) . ')';
}
if ($bannedids) {
$wheres[] = 'albumid NOT IN (' . dimplode($bannedids) . ')';
}
if ($uids) {
$wheres[] = 'uid IN (' . dimplode($uids) . ')';
}
if ($catid) {
$wheres[] = 'catid IN (' . dimplode($catid) . ')';
}
$wheres[] = "friend = '0'";
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$sql = "SELECT * FROM " . DB::table('home_album') . " WHERE {$wheresql} ORDER BY {$orderby} DESC";
$query = DB::query($sql . " LIMIT {$startrow},{$items};");
while ($data = DB::fetch($query)) {
$list[] = array('id' => $data['albumid'], 'idtype' => 'albumid', 'title' => cutstr($data['albumname'], $titlelength), 'url' => "home.php?mod=space&uid={$data['uid']}&do=album&id={$data['albumid']}", 'pic' => 'album/' . $data['pic'], 'picflag' => $data['picflag'], 'summary' => '', 'fields' => array('uid' => $data['uid'], 'username' => $data['username'], 'dateline' => $data['dateline'], 'updatetime' => $data['updatetime'], 'picnum' => $data['picnum']));
}
return array('html' => '', 'data' => $list);
}
示例3: viewthread_modoption
public function viewthread_modoption()
{
global $_G;
if (!$_G['adminid']) {
return false;
}
$usergroupsfeedlist = unserialize($_G['setting']['qqgroup_usergroup_feed_list']);
if (empty($usergroupsfeedlist) || !in_array($_G['groupid'], $usergroupsfeedlist)) {
if (self::$util->isfounder($_G['member']) == false) {
return false;
}
}
$tid = $_G['tid'];
$title = urlencode(trim($_G['forum_thread']['subject']));
$post = C::t('forum_post')->fetch_all_by_tid_position($_G['fotum_thread']['posttableid'], $_G['tid'], 1);
include_once libfile('function/discuzcode');
$content = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", '', trim($post[0]['message']));
$content = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", '', $content);
$content = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", '', $content);
$content = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $content);
$content = strip_tags(discuzcode($content, 0, 0, 0));
$content = preg_replace('%\\[attach\\].*\\[/attach\\]%im', '', $content);
$content = str_replace(' ', ' ', $content);
$content = urlencode(cutstr($content, 50, ''));
include template('qqgroup:push');
return trim($return);
}
示例4: processCollectionData
function processCollectionData($collection, $tf = array(), $orderby = '')
{
if (count($collection) <= 0) {
return array();
}
require_once libfile('function/discuzcode');
foreach ($collection as $ctid => &$curvalue) {
$curvalue['updated'] = $curvalue['lastupdate'] > $tf[$ctid]['lastvisit'] ? 1 : 0;
$curvalue['tflastvisit'] = $tf[$ctid]['lastvisit'];
$curvalue['lastupdate'] = dgmdate($curvalue['lastupdate']);
$curvalue['dateline'] = dgmdate($curvalue['dateline']);
$curvalue['lastposttime'] = dgmdate($curvalue['lastposttime']);
$curvalue['avgrate'] = number_format($curvalue['rate'], 1);
$curvalue['star'] = imgdisplayrate($curvalue['rate']);
$curvalue['lastposterhtml'] = rawurlencode($curvalue['lastposter']);
$curvalue['shortdesc'] = cutstr(strip_tags(discuzcode($curvalue['desc'])), 50);
$curvalue['arraykeyword'] = parse_keyword($curvalue['keyword'], false, false);
if ($curvalue['arraykeyword']) {
foreach ($curvalue['arraykeyword'] as $kid => $s_keyword) {
$curvalue['urlkeyword'][$kid] = rawurlencode($s_keyword);
}
}
if ($orderby == 'commentnum') {
$curvalue['displaynum'] = $curvalue['commentnum'];
} elseif ($orderby == 'follownum') {
$curvalue['displaynum'] = $curvalue['follownum'];
} else {
$curvalue['displaynum'] = $curvalue['threadnum'];
}
}
return $collection;
}
示例5: init
function init($attach, $type = 'temp', $extid = 0, $forcename = '')
{
if (!is_array($attach) || empty($attach) || !$this->is_upload_file($attach['tmp_name']) || trim($attach['name']) == '' || $attach['size'] == 0) {
$this->attach = array();
$this->errorcode = -1;
return false;
} else {
$this->type = $this->check_dir_type($type);
$this->extid = intval($extid);
$this->forcename = $forcename;
$attach['size'] = intval($attach['size']);
$attach['name'] = trim($attach['name']);
$attach['thumb'] = '';
$attach['ext'] = $this->fileext($attach['name']);
$attach['name'] = htmlspecialchars($attach['name'], ENT_QUOTES);
if (strlen($attach['name']) > 90) {
$attach['name'] = cutstr($attach['name'], 80, '') . '.' . $attach['ext'];
}
$attach['isimage'] = $this->is_image_ext($attach['ext']);
$attach['extension'] = $this->get_target_extension($attach['ext']);
$attach['attachdir'] = $this->get_target_dir($this->type, $extid);
$attach['attachment'] = $attach['attachdir'] . $this->get_target_filename($this->type, $this->extid, $this->forcename) . '.' . $attach['extension'];
$attach['target'] = getglobal('setting/attachdir') . './' . $this->type . '/' . $attach['attachment'];
$this->attach =& $attach;
$this->errorcode = 0;
return true;
}
}
示例6: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
$uids = isset($parameter['uids']) && !in_array(0, (array) $parameter['uids']) ? $parameter['uids'] : '';
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = isset($parameter['items']) ? intval($parameter['items']) : 10;
$titlelength = intval($parameter['titlelength']);
$orderby = isset($parameter['orderby']) && in_array($parameter['orderby'], array('dateline', 'replynum')) ? $parameter['orderby'] : 'dateline';
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$datalist = $list = array();
$wheres = array();
if ($uids) {
$wheres[] = 'uid IN (' . dimplode($uids) . ')';
}
if ($bannedids) {
$wheres[] = 'doid NOT IN (' . dimplode($bannedids) . ')';
}
$wheres[] = " status = '0'";
$wheresql = $wheres ? implode(' AND ', $wheres) : '1';
$query = DB::query("SELECT * FROM " . DB::table('home_doing') . " WHERE {$wheresql} ORDER BY {$orderby} DESC LIMIT {$startrow},{$items}");
while ($data = DB::fetch($query)) {
$datalist = array('id' => $data['doid'], 'idtype' => 'doid', 'title' => cutstr(strip_tags($data['message']), $titlelength, ''), 'url' => 'home.php?mod=space&uid=' . $data['uid'] . '&do=doing&doid=' . $data['doid'], 'pic' => '', 'summary' => '', 'fields' => array('fulltitle' => strip_tags($data['message']), 'uid' => $data['uid'], 'username' => $data['username'], 'avatar' => avatar($data['uid'], 'small', true, false, false, $_G['setting']['ucenterurl']), 'avatar_middle' => avatar($data['uid'], 'middle', true, false, false, $_G['setting']['ucenterurl']), 'avatar_big' => avatar($data['uid'], 'big', true, false, false, $_G['setting']['ucenterurl']), 'dateline' => $data['dateline'], 'replynum' => $data['replynum']));
if ($titlelength) {
$datalist['title'] = cutstr(strip_tags($data['message']), $titlelength);
} else {
$datalist['title'] = strip_tags($data['message'], '<img>');
}
$list[] = $datalist;
}
return array('html' => '', 'data' => $list);
}
示例7: getrss
function getrss($catid)
{
global $_SGLOBAL, $_SCONFIG;
$rssarr = array();
$attacharr = array();
if (empty($_SCONFIG['rssnum'])) {
$_SCONFIG['rssnum'] = 10;
}
$sql = "SELECT si.itemid, si.uid, si.username, si.subject, sn.*, si.dateline, c.name FROM " . tname('spaceitems') . " si INNER JOIN " . tname('categories') . " c ON si.catid = c.catid LEFT JOIN " . tname('spacenews') . " sn ON si.itemid = sn.itemid WHERE si.type='news' ";
if (!empty($catid)) {
$sql .= " AND si.catid='{$catid}' ";
}
$sql .= " ORDER BY si.dateline DESC LIMIT 100";
$query = $_SGLOBAL['db']->query($sql);
while ($items = $_SGLOBAL['db']->fetch_array($query)) {
$othermsgarr = array();
$items['message'] = cutstr($items['message'], 255, 1);
if (!empty($othermsgarr)) {
$items['message'] = implode('<br>', $othermsgarr) . '<br>' . $items['message'];
}
if (!empty($items['hash'])) {
$attacharr[] = trim($items['hash']);
}
$rssarr[$items['itemid']] = $items;
}
return $rssarr;
}
示例8: Adddesign
function Adddesign()
{
$id = jget('id', 'int');
$data = array();
$data['name'] = cutstr(trim($this->Post['plugin_name']), 40);
$data['identifier'] = cutstr(trim($this->Post['identifier']), 40);
$data['version'] = cutstr(trim($this->Post['version']), 10);
$data['copyright'] = cutstr(trim($this->Post['copyright']), 80);
$data['description'] = cutstr($this->Post['description'], 100);
$data['directory'] = $data['identifier'] . '/';
$oldidentifier = jget('old_identifier');
if (empty($data['name'])) {
$this->Messager("插件名不能为空");
}
if ($oldidentifier == $data['identifier']) {
$is_exists = false;
} else {
$is_exists = jtable('plugin')->info(array('identifier' => $data['identifier']));
}
if ($is_exists != false || empty($data['identifier']) || !preg_match("/^[a-z]+[a-z0-9_]*[a-z0-9]+\$/i", $data['identifier'])) {
$this->Messager("插件唯一识别符不合法,或不能为空");
}
if (empty($data['version'])) {
$this->Messager("插件版本号不能为空");
}
if (empty($data['copyright'])) {
$this->Messager("版权信息不能为空");
}
$result = jtable('plugin')->update($data, array('pluginid' => $id));
$this->Messager("插件设计完善成功", 'admin.php?mod=plugindesign&code=design&id=' . $id);
}
示例9: init
function init($file, $type, $attachdir)
{
if (!is_array($file) || empty($file) || !$this->is_upload_file($file['tmp_name']) || trim($file['name']) == '' || $file['size'] == 0) {
$this->file = array();
$this->errorcode = 2;
//上传失败
return false;
} else {
$this->type = $this->check_dir_type($type);
$this->attachdir = BLOG_ROOT . '/' . $attachdir;
$file['size'] = intval($file['size']);
$file['name'] = trim($file['name']);
$file['thumb'] = '';
$file['ext'] = $this->fileext($file['name']);
$file['name'] = htmlspecialchars($file['name'], ENT_QUOTES);
if (strlen($file['name']) > 90) {
$file['name'] = cutstr($file['name'], 80, '') . '.' . $file['ext'];
}
$file['isimage'] = $this->is_image_ext($file['ext']);
$file['filedir'] = $this->get_target_dir($this->type);
$file['filepath'] = $file['filedir'] . $this->get_target_filename() . '.jpg';
$file['target'] = $this->attachdir . '/' . $this->type . '/' . $file['filepath'];
$file['imgurl'] = $attachdir . '/' . $this->type . '/' . $file['filepath'];
$this->file =& $file;
$this->errorcode = 0;
return true;
}
}
示例10: getdata
function getdata($style, $parameter)
{
global $_G;
$parameter = $this->cookparameter($parameter);
$fups = isset($parameter['fups']) && !in_array(0, (array) $parameter['fups']) ? $parameter['fups'] : '';
$orderby = isset($parameter['orderby']) ? in_array($parameter['orderby'], array('displayorder', 'threads', 'posts', 'todayposts')) ? $parameter['orderby'] : 'displayorder' : 'displayorder';
$titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
$summarylength = isset($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
$startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
$items = !empty($parameter['items']) ? intval($parameter['items']) : 10;
$bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
$sqlban = !empty($bannedids) ? ' AND f.fid NOT IN (' . dimplode($bannedids) . ')' : '';
if (empty($fups)) {
loadcache('forums');
if (empty($_G['cache']['forums'])) {
$fups = array('0');
} else {
$fups = array_keys($_G['cache']['forums']);
}
}
$ffadd1 = ", ff.icon, ff.description";
$ffadd2 = "LEFT JOIN `" . DB::table('forum_forumfield') . "` ff ON f.`fid`=ff.`fid`";
$query = DB::query("SELECT f.* {$ffadd1}\r\n\t\t\tFROM `" . DB::table('forum_forum') . "` f {$ffadd2}\r\n\t\t\tWHERE\r\n\t\t\t" . ($fups ? "f.`fup` IN (" . dimplode($fups) . ") " : "1 ") . "\r\n\t\t\tAND f.`status`='1' AND f.`type`!='group'\r\n\t\t\t{$sqlban}\r\n\t\t\tORDER BY " . ($orderby == 'displayorder' ? "f.fup, f.`displayorder` ASC " : "f.`{$orderby}` DESC") . " LIMIT {$startrow}, {$items}");
$datalist = $list = array();
$attachurl = preg_match('/^(http|ftp|ftps|https):\\/\\//', $_G['setting']['attachurl']) ? $_G['setting']['attachurl'] : $_G['siteurl'] . $_G['setting']['attachurl'];
while ($data = DB::fetch($query)) {
if (!empty($data['icon'])) {
$data['icon'] = preg_match('/^(http|ftp|ftps|https):\\/\\//', $data['icon']) ? $data['icon'] : $attachurl . 'common/' . $data['icon'];
} else {
$data['icon'] = 'static/image/common/forum_new.gif';
}
$list[] = array('id' => $data['fid'], 'idtype' => 'fid', 'title' => cutstr($data['name'], $titlelength, ''), 'url' => 'forum.php?mod=forumdisplay&fid=' . $data['fid'], 'pic' => '', 'summary' => cutstr($data['description'], $summarylength, ''), 'fields' => array('fulltitle' => $data['name'], 'icon' => $data['icon'], 'threads' => intval($data['threads']), 'posts' => intval($data['posts']), 'todayposts' => intval($data['todayposts'])));
}
return array('html' => '', 'data' => $list);
}
示例11: listtitle
public function listtitle($db, $cid, $length, $limit, $parentclass)
{
$sql = 'select * from `article` where';
if ($parentclass) {
$sql1 = 'select `cid` from `class` where isfinal=1 and parentclass like \'' . $parentclass . '|' . $cid . ',%\'';
$result = $db->_query($sql1);
if ($result->num_rows) {
for ($i = 0; $i < $result->num_rows; ++$i) {
$class = $result->fetch();
$sql .= 'or cid=\'' . $class['cid'] . '\' ';
}
$sql = substr($sql, 2);
} else {
return '暂无内容';
}
$sql .= 'order by aid desc';
} else {
$sql .= ' `cid`=\'' . $cid . '\' order by aid desc';
}
$result = $db->_query($sql, $limit);
if (!$result->num_rows) {
return '暂无内容';
}
$listtitle = '';
for ($i = 0; $i < $result->num_rows; ++$i) {
$article = $result->fetch();
$article['title'] = cutstr($article['title']);
include ABSPATH . TPLPATH . 'listtitle.html';
$listtitle .= $listtitle_html;
}
return $listtitle;
}
示例12: getstr
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);
}
示例13: spacecutstr
function spacecutstr($str, $length)
{
$bbcodes = 'b|i|u|color|size|font|align|list|indent|url|email|code|free|table|tr|td|img|swf|payto|float';
$str = shtmlspecialchars(cutstr(strip_tags(preg_replace(array("/\\[hide=?\\d*\\](.+?)\\[\\/hide\\]/is", "/\\[quote](.*)\\[\\/quote]/siU", "/\\[({$bbcodes})=?.*\\]/iU", "/\\[\\/({$bbcodes})\\]/i", "/\\[attach\\](\\d+)\\[\\/attach\\]/i"), array("[b]***[/b]", '', '', '', ''), $str)), $length));
$find = array("/http:\\/\\/[a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\()|]+?\\.(jpg|gif|png|bmp)/is", "/(\n|\r|\r\n){2,}/", "/\\s{2,}/");
$replace = array("<img onload=\"if(this.width>320) {this.resized=true;this.width=320;}\" src=\"\\0\">", "\r\n", '');
$str = preg_replace($find, $replace, $str);
return trim(nl2br($str));
}
示例14: showlistrowphoto
function showlistrowphoto($value)
{
global $_G, $BASESCRIPT;
$mlist = '';
$value['url'] = 'store.php?id=' . $value['shopid'] . '&action=album&xid=' . $value['albumid'] . '" target="_blank"';
$imgurl = getattachurl($value['subjectimage'], 1);
$value['subject'] = cutstr($value['subject'], 15);
$mlist = "\n\t<li>\t\t \n\t\t<div class=\"b\">\n\t\t\t\t\t<p><a href=\"{$value['url']}\" rel=\"internal\" title=\"{$value['subject']}\">\n\t\t\t<img class=\"fit129\" src=\"{$imgurl}\" rel=\"\" height=\"128\" width=\"128\" /></a>\n\t\t\t</p>\n\t\t</div>\n\t\n\t\t<div class=\"w\" style=\"margin-top:5px; \">\n\t\t\t<div id=\"flExpand\" style=\"height:75; line-height:20px;\">\n\t\t\t\t<div id=\"div_subject_{$value['itemid']}\" style=\"position:absolute; display:none;\">\n\t\t\t\t\t<input id=\"input_subject_{$value['itemid']}\" style=\"height:20px; border:#ccc 1px solid; padding:1px;\" name=\"subject['{$value['itemid']}']\" onblur=\"edit_photo_subject({$value['itemid']}, this.value);\" value=\"{$value['subject']}\" />\n\t\t\t\t</div>\n\t\t\t\t<a id=\"label_subject_{$value['itemid']}\" href=\"javascript:;\" onclick=\"start_edit_photo_subject('{$value['itemid']}');\" style=\"display:block; height:30px; line-height:30px; text-decoration:none;\" rel=\"internal\" title=\"{$value['subject']}\">{$value['subject']} <img src=\"static/image/ico_edit.png\" /></a>\n\t\t\t\t" . lang('photo_albumid') . ': ' . $value['title'] . "<br />\n\t\t\t\t" . "<div><a href=\"" . $BASESCRIPT . '?action=batchmod&operation=setalbumimg&albumid=' . $value['albumid'] . '&photoid=' . $value['itemid'] . "\">" . lang('setalbumimg') . "</a></div>" . "\n\t\t\t\t<input class=\"checkbox\" style=\"\" type=\"checkbox\" name=\"item[]\" value=\"" . $value['itemid'] . "\" checked />" . lang('select') . "\n\t\t\t\t<span></span>\n\t\t\t</div>\n\t\t</div>\n\t</li>\n\t";
return $mlist;
}
示例15: _userReportType
private function _userReportType($res, $rtype, $rid, $message)
{
global $_G;
if ($rtype == 'post') {
$tid = UserReport::getTidByPid($rid);
}
$fid = intval($_GET['fid']);
$uid = intval($_GET['uid']);
$message = WebUtils::t(rawurldecode($message));
$default_url = array('user' => 'home.php?mod=space&uid=', 'post' => 'forum.php?mod=redirect&goto=findpost&ptid=' . $tid . '&pid=', 'thread' => 'forum.php?mod=viewthread&tid=', 'group' => 'forum.php?mod=group&fid=', 'album' => 'home.php?mod=space&do=album&uid=' . $uid . '&id=', 'blog' => 'home.php?mod=space&do=blog&uid=' . $uid . '&id=', 'pic' => 'home.php?mod=space&do=album&uid=' . $uid . '&picid=');
$url = '';
if ($rid && !empty($default_url[$rtype])) {
$url = $default_url[$rtype] . intval($rid);
} else {
$url = addslashes(dhtmlspecialchars(base64_decode($_GET['url'])));
$url = preg_match("/^http[s]?:\\/\\/[^\\[\"']+\$/i", trim($url)) ? trim($url) : '';
}
if (empty($url)) {
$res = $this->makeErrorInfo($res, 'report_parameters_invalid');
} else {
$urlkey = md5($url);
$message = censor(cutstr(dhtmlspecialchars(trim($message)), 200, ''));
$message = $_G['username'] . ' : ' . rtrim($message, "\\");
if ($reportid = C::t('common_report')->fetch_by_urlkey($urlkey)) {
C::t('common_report')->update_num($reportid, $message);
} else {
$data = array('url' => $url, 'urlkey' => $urlkey, 'uid' => $_G['uid'], 'username' => $_G['username'], 'message' => $message, 'dateline' => TIMESTAMP);
if ($fid) {
$data['fid'] = $fid;
}
C::t('common_report')->insert($data);
$report_receive = unserialize($_G['setting']['report_receive']);
$moderators = array();
if ($report_receive['adminuser']) {
foreach ($report_receive['adminuser'] as $touid) {
notification_add($touid, 'report', 'new_report', array('from_id' => 1, 'from_idtype' => 'newreport'), 1);
}
}
if ($fid && $rtype == 'post') {
foreach (C::t('forum_moderator')->fetch_all_by_fid($fid, false) as $row) {
$moderators[] = $row['uid'];
}
if ($report_receive['supmoderator']) {
$moderators = array_unique(array_merge($moderators, $report_receive['supmoderator']));
}
foreach ($moderators as $touid) {
$touid != $_G['uid'] && !in_array($touid, $report_receive) && notification_add($touid, 'report', 'new_post_report', array('fid' => $fid, 'from_id' => 1, 'from_idtype' => 'newreport'), 1);
}
}
}
$params['noError'] = 1;
$res = $this->makeErrorInfo($res, 'report_succeed', $params);
}
return $res;
}