本文整理汇总了PHP中threadsort_validator函数的典型用法代码示例。如果您正苦于以下问题:PHP threadsort_validator函数的具体用法?PHP threadsort_validator怎么用?PHP threadsort_validator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了threadsort_validator函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_editpost
public function before_editpost($parameters)
{
global $_G;
$sortid = $parameters['sortid'];
$isfirstpost = $this->post['first'] ? 1 : 0;
if ($isfirstpost) {
$parameters['typeid'] = isset($this->forum['threadtypes']['types'][$parameters['typeid']]) ? $parameters['typeid'] : 0;
if (!$this->forum['ismoderator'] && !empty($this->forum['threadtypes']['moderators'][$this->thread['typeid']])) {
$parameters['typeid'] = $this->thread['typeid'];
}
$parameters['sortid'] = isset($this->forum['threadsorts']['types'][$parameters['sortid']]) ? $parameters['sortid'] : 0;
$typeexpiration = intval($_GET['typeexpiration']);
if (!$parameters['typeid'] && $this->forum['threadtypes']['required'] && !$this->thread['special']) {
showmessage('post_type_isnull');
}
if ($this->forum['threadsorts']['types'][$sortid] && $_G['forum_checkoption']) {
$_G['forum_optiondata'] = threadsort_validator($_GET['typeoption'], $this->post['pid']);
}
$this->param['threadimageaid'] = 0;
$this->param['threadimage'] = array();
if ($this->forum['threadsorts']['types'][$parameters['sortid']] && $_G['forum_optiondata'] && is_array($_G['forum_optiondata'])) {
$sql = $separator = $filedname = $valuelist = '';
foreach ($_G['forum_optiondata'] as $optionid => $value) {
$value = censor(daddslashes($value));
if ($_G['forum_optionlist'][$optionid]['type'] == 'image') {
$identifier = $_G['forum_optionlist'][$optionid]['identifier'];
$newsortaid = intval($_GET['typeoption'][$identifier]['aid']);
if ($newsortaid && $_GET['oldsortaid'][$identifier] && $newsortaid != $_GET['oldsortaid'][$identifier]) {
$attach = C::t('forum_attachment_n')->fetch('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
C::t('forum_attachment')->delete($_GET['oldsortaid'][$identifier]);
C::t('forum_attachment_n')->delete('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
dunlink($attach);
$this->param['threadimageaid'] = $newsortaid;
convertunusedattach($newsortaid, $this->thread['tid'], $this->post['pid']);
}
} else {
if ($_G['forum_optionlist'][$optionid]['type'] == 'face') {
$identifier = $_G['forum_optionlist'][$optionid]['identifier'];
$newsortaid = intval($_GET['typeoption'][$identifier]['aid']);
if ($newsortaid && $_GET['oldsortaid'][$identifier] && $newsortaid != $_GET['oldsortaid'][$identifier]) {
$attach = C::t('forum_attachment_n')->fetch('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
C::t('forum_attachment')->delete($_GET['oldsortaid'][$identifier]);
C::t('forum_attachment_n')->delete('tid:' . $this->thread['tid'], $_GET['oldsortaid'][$identifier]);
dunlink($attach);
$this->param['threadimageaid'] = $newsortaid;
convertunusedattach($newsortaid, $this->thread['tid'], $this->post['pid']);
}
}
}
if ($_G['forum_optionlist'][$optionid]['unchangeable']) {
continue;
}
if (($_G['forum_optionlist'][$optionid]['search'] || in_array($_G['forum_optionlist'][$optionid]['type'], array('radio', 'select', 'number'))) && $value) {
$filedname .= $separator . $_G['forum_optionlist'][$optionid]['identifier'];
$valuelist .= $separator . "'{$value}'";
$sql .= $separator . $_G['forum_optionlist'][$optionid]['identifier'] . "='{$value}'";
$separator = ' ,';
}
C::t('forum_typeoptionvar')->update_by_tid($this->thread['tid'], array('value' => $value, 'sortid' => $parameters['sortid']), false, false, $optionid);
}
if ($typeexpiration) {
C::t('forum_typeoptionvar')->update_by_tid($this->thread['tid'], array('expiration' => TIMESTAMP + $typeexpiration), false, false, null, $parameters['sortid']);
}
if ($sql || $filedname && $valuelist) {
if (C::t('forum_optionvalue')->fetch_all_tid($parameters['sortid'], "WHERE tid='" . $this->thread['tid'] . "'")) {
if ($sql) {
C::t('forum_optionvalue')->update($parameters['sortid'], $this->thread['tid'], $this->forum['fid'], $sql);
}
} elseif ($filedname && $valuelist) {
C::t('forum_optionvalue')->insert($parameters['sortid'], "({$filedname}, tid, fid) VALUES ({$valuelist}, '" . $this->thread['tid'] . "', '" . $this->forum['fid'] . "')");
}
}
}
}
}
示例2: showmessage
showmessage('debate_umpire_invalid');
}
}
$affirmpoint = censor(dhtmlspecialchars($_G['gp_affirmpoint']));
$negapoint = censor(dhtmlspecialchars($_G['gp_negapoint']));
DB::query("UPDATE " . DB::table('forum_debate') . " SET affirmpoint='{$affirmpoint}', negapoint='{$negapoint}', endtime='{$endtime}', umpire='{$_G['gp_umpire']}' WHERE tid='{$_G['tid']}'");
} elseif ($specialextra) {
@(include_once DISCUZ_ROOT . './source/plugin/' . $_G['setting']['threadplugins'][$specialextra]['module'] . '.class.php');
$classname = 'threadplugin_' . $specialextra;
if (class_exists($classname) && method_exists($threadpluginclass = new $classname(), 'editpost_submit')) {
$threadpluginclass->editpost_submit($_G['fid'], $_G['tid']);
}
}
$_G['forum_optiondata'] = array();
if ($_G['forum']['threadsorts']['types'][$sortid] && $_G['forum_checkoption']) {
$_G['forum_optiondata'] = threadsort_validator($_G['gp_typeoption'], $pid);
}
$threadimageaid = 0;
$threadimage = array();
if ($_G['forum']['threadsorts']['types'][$sortid] && $_G['forum_optiondata'] && is_array($_G['forum_optiondata'])) {
$sql = $separator = $filedname = $valuelist = '';
foreach ($_G['forum_optiondata'] as $optionid => $value) {
if ($_G['forum_optionlist'][$optionid]['type'] == 'image') {
$identifier = $_G['forum_optionlist'][$optionid]['identifier'];
$newsortaid = intval($_G['gp_typeoption'][$identifier]['aid']);
if ($newsortaid && $newsortaid != $_G['gp_oldsortaid'][$identifier]) {
$attach = DB::fetch_first("SELECT attachment, thumb, remote, aid FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE aid='{$_G['gp_oldsortaid'][$identifier]}'");
DB::query("DELETE FROM " . DB::table('forum_attachment') . " WHERE aid='{$_G['gp_oldsortaid'][$identifier]}'");
DB::query("DELETE FROM " . DB::table(getattachtablebytid($_G['tid'])) . " WHERE aid='{$_G['gp_oldsortaid'][$identifier]}'");
dunlink($attach);
$threadimageaid = $newsortaid;
示例3: threadsort_optiondata
if (!submitcheck('editsubmit')) {
threadsort_optiondata($sortid, $_G['cache']['category_option_' . $sortid], $_G['cache']['category_template_' . $sortid], $tid);
$attachs = array();
if ($sortdata['attachid']) {
$query = DB::query("SELECT * FROM " . DB::table('category_' . $modidentifier . '_pic') . " WHERE tid='{$tid}'");
while ($attach = DB::fetch($query)) {
$attachs[] = $attach;
}
}
if (count($attachs) < $category_sort['imgnum']) {
$imgnum = array();
$uploadnum = $category_sort['imgnum'] - count($attachs);
$imgnum = array_pad($imgnum, $uploadnum, 0);
}
} else {
$_G['category_optiondata'] = threadsort_validator($_G['gp_typeoption'], $pid);
$_G['gp_expiration'] = $_G['gp_expiration'] ? $sortdata['expiration'] ? $sortdata['expiration'] + intval($_G['gp_expiration']) : $_G['timestamp'] + intval($_G['gp_expiration']) : $sortdata['expiration'];
$sql = $separator = $newaidadd = '';
foreach ($_G['category_optiondata'] as $optionid => $value) {
if (($_G['category_optionlist'][$optionid]['search'] || in_array($_G['category_optionlist'][$optionid]['type'], array('radio', 'select', 'number'))) && $value) {
$sql .= $separator . $_G['category_optionlist'][$optionid]['identifier'] . "='{$value}'";
$separator = ' ,';
}
DB::query("UPDATE " . DB::table('category_sortoptionvar') . " SET value='{$value}', sortid='{$sortid}', expiration='{$_G['gp_expiration']}' WHERE tid='{$tid}' AND optionid='{$optionid}'");
}
if ($sql) {
DB::query("UPDATE " . DB::table('category_sortvalue') . "{$sortid} SET {$sql} WHERE tid='{$tid}'");
}
if (!empty($subject) || !empty($message)) {
$message = censor(trim($_G['gp_message']));
DB::query("UPDATE " . DB::table('category_' . $modidentifier . '_thread') . " SET subject='{$subject}', message='{$message}' WHERE tid='{$tid}'");
示例4: updateattach
}
}
$allowpostattach && ($attachnew || $attachdel || $special == 2 && $tradeaid || $isfirstpost && $sortid) && updateattach();
if ($uattachment || $attachdel) {
$tattachment = $db->result_first("SELECT count(*) FROM {$tablepre}posts p, {$tablepre}attachments a WHERE a.tid='{$tid}' AND a.isimage IN ('1', '-1') AND a.pid=p.pid AND p.invisible='0' LIMIT 1") ? 2 : ($db->result_first("SELECT count(*) FROM {$tablepre}posts p, {$tablepre}attachments a WHERE a.tid='{$tid}' AND a.pid=p.pid AND p.invisible='0' LIMIT 1") ? 1 : 0);
$db->query("UPDATE {$tablepre}threads SET attachment='{$tattachment}' WHERE tid='{$tid}'");
}
if ($special == 2 && $allowposttrade) {
$oldtypeid = $db->result_first("SELECT typeid FROM {$tablepre}trades WHERE pid='{$pid}'");
$oldtypeid = isset($tradetypes[$oldtypeid]) ? $oldtypeid : 0;
$tradetypeid = !$tradetypeid ? $oldtypeid : $tradetypeid;
$optiondata = array();
threadsort_checkoption($oldtypeid, 1);
$optiondata = array();
if ($tradetypes && $typeoption && is_array($typeoption) && $checkoption) {
$optiondata = threadsort_validator($typeoption);
}
if ($tradetypes && $optiondata && is_array($optiondata)) {
foreach ($optiondata as $optionid => $value) {
if ($oldtypeid) {
$db->query("UPDATE {$tablepre}tradeoptionvars SET value='{$value}' WHERE pid='{$pid}' AND optionid='{$optionid}'");
} else {
$db->query("INSERT INTO {$tablepre}tradeoptionvars (sortid, pid, optionid, value)\r\n\t\t\t\t\t\t\tVALUES ('{$tradetypeid}', '{$pid}', '{$optionid}', '{$value}')");
}
}
}
if (!$oldtypeid) {
$db->query("UPDATE {$tablepre}trades SET typeid='{$tradetypeid}' WHERE pid='{$pid}'");
}
if ($trade = $db->fetch_first("SELECT * FROM {$tablepre}trades WHERE tid='{$tid}' AND pid='{$pid}'")) {
$seller = dhtmlspecialchars(trim($seller));
示例5: article_move_forums
function article_move_forums($arr, $old_arr)
{
global $_G;
$arr['content'] = preg_replace(array('/<center>([\\s\\S]*?)<\\/center>/', '/\\s(?=\\s)/'), array("[align=center]\\1[/align]", ''), $arr['content']);
$subject = addslashes(trim($arr['title']));
if ($arr['check']) {
if (!strlen($subject)) {
return FALSE;
}
$num = DB::result_first('SELECT COUNT(*) FROM ' . DB::table('forum_thread') . " WHERE subject='{$subject}' AND displayorder > '-1'");
if ($num) {
return FALSE;
}
}
if ($arr['contents'] > 1 && $arr['is_content_reply'] != 1) {
$arr['reply'] = array();
}
$time_arr = create_public_time($arr, count($arr['reply']) + 1, 1);
if ($arr['contents'] == 1) {
$uid_arr = get_rand_uid($arr, 'reply');
} else {
if ($arr['is_content_reply'] != 1) {
if ($arr['content_arr']) {
$arr['content'] = content_merge($arr['content_arr']);
}
$uid_arr = get_rand_uid($arr);
}
}
$arr['public_time'] = $arr['public_time'] ? $arr['public_time'] : array_shift($time_arr);
require_once libfile('function/editor');
require_once libfile('function/forum');
$subject = htmlspecialchars_decode(format_html($subject));
$subject = htmlspecialchars_decode(format_html($subject));
$arr['content'] = dstripslashes($arr['content']);
$arr['content'] = img_htmlbbcode($arr['content'], $arr['page_url']);
$arr['content'] = media_htmlbbcode($arr['content'], $arr['page_url']);
$arr['content'] = audio_htmlbbcode($arr['content'], $arr['page_url']);
$message = htmlspecialchars_decode(html2bbcode($arr['content']));
$message = dstripslashes(format_html($message));
$arr['fid'] = $_G['fid'] = $_GET['forums'] ? $_GET['forums'] : $arr['forum_fid'];
$_G['uid'] = $arr['uid'] ? $arr['uid'] : $_G['uid'];
$view_num = $arr['view_num'];
require_once libfile('function/post');
$special = 0;
if (trim($subject) == '' || trim($message) == '') {
return -1;
}
if (!$sortid && !$special && trim($message) == '') {
return -1;
}
$_GET['save'] = $arr['uid'] ? $arr['uid'] : $_G['uid'];
$uid = $_GET['save'];
$typeid = intval($_GET['threadtypeid']) ? intval($_GET['threadtypeid']) : $arr['forum_typeid'];
$displayorder = 0;
$digest = $_G['forum']['ismoderator'] && $_G['group']['allowdigestthread'] && !empty($_GET['addtodigest']) ? 1 : 0;
$readperm = $_G['group']['allowsetreadperm'] ? $readperm : 0;
$isanonymous = $_G['group']['allowanonymous'] && $_GET['isanonymous'] ? 1 : 0;
$price = intval($price);
$price = $_G['group']['maxprice'] && !$special ? $price <= $_G['group']['maxprice'] ? $price : $_G['group']['maxprice'] : 0;
if (!$typeid && $_G['forum']['threadtypes']['required'] && !$special) {
return -2;
}
if (!$sortid && $_G['forum']['threadsorts']['required'] && !$special) {
return -3;
}
if ($price > 0 && floor($price * (1 - $_G['setting']['creditstax'])) == 0) {
return -4;
}
$_G['forum'] = DB::fetch_first("SELECT * FROM " . DB::table('forum_forum') . " WHERE fid = '{$arr['fid']}'");
//查询版块信息
if (!$_G['forum']) {
return -5;
}
$sortid = $special && $_G['forum']['threadsorts']['types'][$sortid] ? 0 : $sortid;
$typeexpiration = intval($_GET['typeexpiration']);
if ($_G['forum']['threadsorts']['expiration'][$typeid] && !$typeexpiration) {
return -5;
}
$_G['forum_optiondata'] = array();
if ($_G['forum']['threadsorts']['types'][$sortid] && !$_G['forum']['allowspecialonly']) {
$_G['forum_optiondata'] = threadsort_validator($_GET['typeoption'], $pid);
}
$author = !$arr['username'] ? $_G['username'] : $arr['username'];
$moderated = $digest || $displayorder > 0 ? 1 : 0;
$thread['status'] = 0;
$_GET['ordertype'] && ($thread['status'] = setstatus(4, 1, $thread['status']));
$_GET['hiddenreplies'] && ($thread['status'] = setstatus(2, 1, $thread['status']));
$_GET['allownoticeauthor'] && ($thread['status'] = setstatus(6, 1, $thread['status']));
$isgroup = $_G['forum']['status'] == 3 ? 1 : 0;
//检查各项设置
$bbcodeoff = checkbbcodes($message, FALSE);
$smileyoff = checksmilies($message, FALSE);
$parseurloff = FALSE;
$htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0;
if ($_G['group']['allowreplycredit']) {
$_GET['replycredit_extcredits'] = intval($_GET['replycredit_extcredits']);
$_GET['replycredit_times'] = intval($_GET['replycredit_times']);
$_GET['replycredit_membertimes'] = intval($_GET['replycredit_membertimes']);
$_GET['replycredit_random'] = intval($_GET['replycredit_random']);
$_GET['replycredit_random'] = $_GET['replycredit_random'] < 0 || $_GET['replycredit_random'] > 99 ? 0 : $_GET['replycredit_random'];
//.........这里部分代码省略.........