本文整理汇总了PHP中getposttablebytid函数的典型用法代码示例。如果您正苦于以下问题:PHP getposttablebytid函数的具体用法?PHP getposttablebytid怎么用?PHP getposttablebytid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getposttablebytid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getpostinfo
function getpostinfo($id, $type, $colsarray = '')
{
global $_G;
$sql = $comma = '';
$type = in_array($type, array('tid', 'pid', 'blogid')) && !empty($type) ? $type : 'tid';
$cols = '*';
if (!empty($colsarray) && is_array($colsarray)) {
$cols = '';
foreach ($colsarray as $val) {
$cols .= $comma . $val;
$comma = ', ';
}
}
switch ($type) {
case 'tid':
$sql = "SELECT {$cols} FROM " . DB::table('forum_thread') . " WHERE tid='{$id}' AND displayorder>='0'";
break;
case 'pid':
$posttable = getposttablebytid($_G['tid']);
$sql = "SELECT {$cols} FROM " . DB::table($posttable) . " p, " . DB::table('forum_thread') . " t WHERE p.pid='{$id}' AND p.invisible='0' AND t.tid=p.tid";
break;
case 'blogid':
$sql = "SELECT {$cols} FROM " . DB::table('home_blog') . " WHERE blogid='{$id}' AND status='0'";
break;
}
if ($sql) {
$info = DB::fetch_first($sql);
if (!$info) {
showmessage('magics_target_nonexistence');
} else {
return daddslashes($info, 1);
}
}
}
示例2: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_pid'])) {
showmessage(lang('magic/namepost', 'namepost_info_nonexistence'));
}
$_G['tid'] = $_G['gp_ptid'];
$post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous'));
$this->_check($post);
$query = DB::query("SELECT username FROM " . DB::table('common_member') . " WHERE uid='{$post['authorid']}'");
$author = daddslashes(DB::result($query, 0), 1);
$thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter'));
$posttable = getposttablebytid($post['tid']);
if ($post['first']) {
$lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : $author;
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE tid='{$post['tid']}' AND first='1'");
} else {
$lastposter = $author;
$author = $thread['author'];
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE pid='{$_G['gp_pid']}'");
}
$forum['lastpost'] = explode("\t", DB::result_first("SELECT lastpost FROM " . DB::table('forum_forum') . " WHERE fid='{$post['fid']}'"));
if ($thread['subject'] == $forum['lastpost'][1] && ($forum['lastpost'][3] == '' && $post['anonymous'])) {
$lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}";
DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='{$post['fid']}'", 'UNBUFFERED');
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET author='{$author}', lastposter='{$lastposter}' WHERE tid='{$post['tid']}'");
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']);
if ($post['authorid'] != $_G['uid']) {
notification_add($post['authorid'], 'magic', lang('magic/namepost', 'namepost_notification'), array('pid' => $_G['gp_pid'], 'tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/namepost', 'namepost_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
示例3: updatersscache
function updatersscache($num)
{
global $_G;
DB::query("DELETE FROM " . DB::table('forum_rsscache') . "");
require_once libfile('function/post');
foreach ($_G['cache']['forums'] as $fid => $forum) {
if ($forum['type'] != 'group') {
$query = DB::query("SELECT tid, readperm, author, dateline, subject\r\n\t\t\t\tFROM " . DB::table('forum_thread') . "\r\n\t\t\t\tWHERE fid='{$fid}' AND displayorder>='0'\r\n\t\t\t\tORDER BY tid DESC LIMIT {$num}");
$forum['name'] = addslashes($forum['name']);
while ($thread = DB::fetch($query)) {
$thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous';
$thread['subject'] = addslashes($thread['subject']);
$posttable = getposttablebytid($thread['tid']);
$post = DB::fetch_first("SELECT pid, attachment, message, status FROM " . DB::table($posttable) . " WHERE tid='{$thread['tid']}' AND first='1'");
$attachdata = '';
if ($post['attachment'] == 2) {
$attach = DB::fetch_first("SELECT remote, attachment, filesize FROM " . DB::table('forum_attachment') . " WHERE pid='{$post['pid']}' AND isimage='1' ORDER BY dateline LIMIT 1");
$attachdata = "\t" . $attach['remote'] . "\t" . $attach['attachment'] . "\t" . $attach['filesize'];
}
$thread['message'] = $post['message'];
$thread['status'] = $post['status'];
$thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(messagecutstr($thread['message'], 250 - strlen($attachdata)) . $attachdata);
DB::query("REPLACE INTO " . DB::table('forum_rsscache') . " (lastupdate, fid, tid, dateline, forum, author, subject, description)\r\n\t\t\t\t\tVALUES ('{$_G['timestamp']}', '{$fid}', '{$thread['tid']}', '{$thread['dateline']}', '{$forum['name']}', '{$thread['author']}', '{$thread['subject']}', '{$thread['description']}')");
}
}
}
}
示例4: post_mobile_message
function post_mobile_message($message, $url_forward, $values, $extraparam, $custom)
{
if ($message == 'comment_add_succeed') {
showmessage($message);
}
if ($values['tid'] && $values['pid']) {
global $_G;
$threadstatus = DB::result_first("SELECT status FROM " . DB::table('forum_thread') . " WHERE tid='{$values['tid']}'");
$setstatusold = base_convert(getstatus($threadstatus, 13) . getstatus($threadstatus, 12) . getstatus($threadstatus, 11), 2, 10);
$updatestatus = false;
if (!empty($_POST['allowsound'])) {
$setstatus = array(1, 0, 0);
$updatestatus = $setstatusold < 4;
} elseif (!empty($_POST['allowphoto'])) {
$setstatus = array(0, 1, 1);
$updatestatus = $setstatusold < 3;
} elseif (!empty($_POST['allowlocal'])) {
$setstatus = array(0, 1, 0);
$updatestatus = $setstatusold < 2;
} else {
$setstatus = array(0, 0, 1);
}
if ($updatestatus) {
foreach ($setstatus as $i => $bit) {
$threadstatus = setstatus(13 - $i, $bit, $threadstatus);
}
//note DB::update('forum_thread', array('status' => $threadstatus), "tid='$values[tid]'");
C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
}
$posttable = getposttablebytid($values['tid']);
$poststatus = DB::result_first("SELECT status FROM " . DB::table($posttable) . " WHERE pid='{$values['pid']}'");
$poststatus = setstatus(4, 1, $poststatus);
if (!empty($_POST['allowlocal'])) {
$poststatus = setstatus(6, 1, $poststatus);
}
if (!empty($_POST['allowsound'])) {
$poststatus = setstatus(7, 1, $poststatus);
}
if (!empty($_POST['mobiletype']) && $_POST['mobiletype'] < 8) {
$mobiletype = base_convert($_POST['mobiletype'], 10, 2);
$mobiletype = sprintf('%03d', $mobiletype);
for ($i = 0; $i < 3; $i++) {
$poststatus = setstatus(10 - $i, $mobiletype[$i], $poststatus);
}
}
//note DB::update($posttable, array('status' => $poststatus), "pid='$values[pid]'");
C::t('forum_post')->update('tid:' . $values['tid'], $values['pid'], array('status' => $poststatus));
if ($_POST['location']) {
list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
C::t('forum_post_location')->insert(array('pid' => $values['pid'], 'tid' => $values['tid'], 'uid' => $_G['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
}
}
}
示例5: trade_create
function trade_create($trade)
{
global $_G;
extract($trade);
$special = 2;
$expiration = $item_expiration ? strtotime($item_expiration) : 0;
$closed = $expiration > 0 && strtotime($item_expiration) < TIMESTAMP ? 1 : $closed;
$item_price = floatval($item_price);
switch ($transport) {
case 'offline':
$item_transport = 0;
break;
case 'seller':
$item_transport = 1;
break;
case 'buyer':
$item_transport = 2;
break;
case 'virtual':
$item_transport = 3;
break;
case 'logistics':
$item_transport = 4;
break;
}
$seller = dhtmlspecialchars($seller);
$item_name = dhtmlspecialchars($item_name);
$item_locus = dhtmlspecialchars($item_locus);
$item_number = intval($item_number);
$item_quality = intval($item_quality);
$item_transport = intval($item_transport);
$postage_mail = intval($postage_mail);
$postage_express = intval($postage_express);
$postage_ems = intval($postage_ems);
$item_type = intval($item_type);
$typeid = intval($typeid);
$item_costprice = floatval($item_costprice);
if (!$item_price || $item_price <= 0) {
$item_price = $postage_mail = $postage_express = $postage_ems = '';
}
if (empty($pid)) {
$posttable = getposttablebytid($tid);
$pid = DB::result_first("SELECT pid FROM " . DB::table($posttable) . " WHERE tid='{$tid}' AND first='1' LIMIT 1");
}
if (!$item_price && $item_credit) {
$seller == '';
}
DB::insert('forum_trade', array('tid' => $tid, 'pid' => $pid, 'typeid' => $typeid, 'sellerid' => $_G['uid'], 'seller' => $author, 'tenpayaccount' => $tenpayaccount, 'account' => $seller, 'subject' => $item_name, 'price' => $item_price, 'amount' => $item_number, 'quality' => $item_quality, 'locus' => $item_locus, 'transport' => $item_transport, 'ordinaryfee' => $postage_mail, 'expressfee' => $postage_express, 'emsfee' => $postage_ems, 'itemtype' => $item_type, 'dateline' => $_G['timestamp'], 'expiration' => $expiration, 'lastupdate' => $_G['timestamp'], 'totalitems' => '0', 'tradesum' => '0', 'closed' => $closed, 'costprice' => $item_costprice, 'aid' => $aid, 'credit' => $item_credit, 'costcredit' => $item_costcredit));
}
示例6: usesubmit
function usesubmit()
{
global $_G;
$id = intval($_G['gp_id']);
if (empty($id)) {
showmessage(lang('magic/anonymouspost', 'anonymouspost_info_nonexistence'));
}
$idtype = !empty($_G['gp_idtype']) ? htmlspecialchars($_G['gp_idtype']) : '';
if (!in_array($idtype, array('pid', 'cid'))) {
showmessage(lang('magic/anonymouspost', 'anonymouspost_use_error'));
}
if ($idtype == 'pid') {
$_G['tid'] = $_G['gp_ptid'];
$post = getpostinfo($id, 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.author', 'p.dateline', 'p.anonymous'));
$this->_check($post);
if ($post['authorid'] != $_G['uid']) {
showmessage('magics_operation_nopermission');
}
$thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter'));
$posttable = getposttablebytid($post['tid']);
if ($post['first']) {
$author = '';
$lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : '';
} else {
$author = $thread['author'];
$lastposter = '';
}
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='1' WHERE pid='{$id}'");
$forum['lastpost'] = explode("\t", DB::result_first("SELECT lastpost FROM " . DB::table('forum_forum') . " WHERE fid='{$post['fid']}'"));
if ($post['dateline'] == $forum['lastpost'][2] && ($post['author'] == $forum['lastpost'][3] || $forum['lastpost'][3] == '' && $post['anonymous'])) {
$lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}";
DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='{$post['fid']}'", 'UNBUFFERED');
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET author='{$author}', lastposter='{$lastposter}' WHERE tid='{$post['tid']}'");
} elseif ($idtype == 'cid') {
$value = DB::fetch_first('SELECT * FROM ' . DB::table('home_comment') . " WHERE cid = '{$id}' AND authorid = '{$_G['uid']}'");
if (empty($value)) {
showmessage('anonymouspost_use_error');
} elseif ($value['author'] == '') {
showmessage('anonymouspost_once_limit');
}
DB::query("UPDATE " . DB::table('home_comment') . " SET author='' WHERE cid='{$id}' AND authorid='{$_G['uid']}'");
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $id);
showmessage(lang('magic/anonymouspost', 'anonymouspost_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
示例7: updatethreadcount
function updatethreadcount($tid, $updateattach = 0)
{
$posttable = getposttablebytid($tid);
$replycount = DB::result_first("SELECT COUNT(*) FROM " . DB::table($posttable) . " WHERE tid='{$tid}' AND invisible='0'") - 1;
$lastpost = DB::fetch_first("SELECT author, anonymous, dateline FROM " . DB::table($posttable) . " WHERE tid='{$tid}' AND invisible='0' ORDER BY dateline DESC LIMIT 1");
$lastpost['author'] = $lastpost['anonymous'] ? lang('forum/misc', 'anonymous') : addslashes($lastpost['author']);
$lastpost['dateline'] = !empty($lastpost['dateline']) ? $lastpost['dateline'] : TIMESTAMP;
if ($updateattach) {
$attach = DB::result_first("SELECT attachment FROM " . DB::table($posttable) . " WHERE tid='{$tid}' AND invisible='0' AND attachment>0 LIMIT 1");
$attachadd = ', attachment=\'' . ($attach ? 1 : 0) . '\'';
} else {
$attachadd = '';
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET replies='{$replycount}', lastposter='{$lastpost['author']}', lastpost='{$lastpost['dateline']}' {$attachadd} WHERE tid='{$tid}'", 'UNBUFFERED');
}
示例8: exit
* $Id: topicadmin_merge.php 31741 2012-09-26 08:12:08Z zhangjie $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['group']['allowmergethread']) {
showmessage('no_privilege_mergethread');
}
if (!submitcheck('modsubmit')) {
include template('forum/topicadmin_action');
} else {
//删除缓存
memory('rm', 'forumdisplay_' . $_G['fid']);
$posttable = getposttablebytid($_G['tid']);
$othertid = intval($_GET['othertid']);
$otherposttable = getposttablebytid($othertid);
$modaction = 'MRG';
$reason = checkreasonpm();
$other = C::t('forum_thread')->fetch_by_tid_displayorder($othertid, 0);
if (!$other) {
showmessage('admin_merge_nonexistence');
} elseif ($other['special']) {
showmessage('special_noaction');
}
if ($othertid == $_G['tid'] || $_G['adminid'] == 3 && $other['fid'] != $_G['forum']['fid']) {
showmessage('admin_merge_invalid');
}
$other['views'] = intval($other['views']);
$other['replies']++;
if (!$other['maxposition']) {
$other['maxposition'] = C::t('forum_post')->fetch_maxposition_by_tid($other['posttableid'], $othertid);
示例9: discuzcode
function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0, $parsetype = '0', $authorid = '0', $allowmediacode = '0', $pid = 0)
{
global $_G;
static $authorreplyexist;
if ($parsetype != 1 && !$bbcodeoff && $allowbbcode && (strpos($message, '[/code]') || strpos($message, '[/CODE]')) !== FALSE) {
$message = preg_replace("/\\s?\\[code\\](.+?)\\[\\/code\\]\\s?/ies", "codedisp('\\1')", $message);
}
$msglower = strtolower($message);
$htmlon = $htmlon && $allowhtml ? 1 : 0;
if (!$htmlon) {
$message = dhtmlspecialchars($message);
}
if (!$smileyoff && $allowsmilies) {
$message = parsesmiles($message);
}
if ($_G['setting']['allowattachurl'] && strpos($msglower, 'attach://') !== FALSE) {
$message = preg_replace("/attach:\\/\\/(\\d+)\\.?(\\w*)/ie", "parseattachurl('\\1', '\\2')", $message);
}
if ($allowbbcode) {
if (strpos($msglower, 'ed2k://') !== FALSE) {
$message = preg_replace("/ed2k:\\/\\/(.+?)\\//e", "parseed2k('\\1')", $message);
}
}
if (!$bbcodeoff && $allowbbcode) {
if (strpos($msglower, '[/url]') !== FALSE) {
$message = preg_replace("/\\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|thunder|synacast){1}:\\/\\/|www\\.|mailto:)?([^\\s\\[\"']+?))?\\](.+?)\\[\\/url\\]/ies", "parseurl('\\1', '\\5', '\\2')", $message);
}
if (strpos($msglower, '[/email]') !== FALSE) {
$message = preg_replace("/\\[email(=([a-z0-9\\-_.+]+)@([a-z0-9\\-_]+[.][a-z0-9\\-_.]+))?\\](.+?)\\[\\/email\\]/ies", "parseemail('\\1', '\\4')", $message);
}
$nest = 0;
while (strpos($msglower, '[table') !== FALSE && strpos($msglower, '[/table]') !== FALSE) {
$message = preg_replace("/\\[table(?:=(\\d{1,4}%?)(?:,([\\(\\)%,#\\w ]+))?)?\\]\\s*(.+?)\\s*\\[\\/table\\]/ies", "parsetable('\\1', '\\2', '\\3')", $message);
if (++$nest > 4) {
break;
}
}
$message = str_replace(array('[/color]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[/p]', '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]', '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'), array('</font>', '</font>', '</font>', '</p>', '<strong>', '</strong>', '<strike>', '</strike>', '<hr class="l" />', '</p>', '<i class="pstatus">', '<i>', '</i>', '<u>', '</u>', '<ul>', '<ul type="1" class="litype_1">', '<ul type="a" class="litype_2">', '<ul type="A" class="litype_3">', '<li>', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>'), preg_replace(array("/\\[color=([#\\w]+?)\\]/i", "/\\[color=(rgb\\([\\d\\s,]+?\\))\\]/i", "/\\[size=(\\d{1,2}?)\\]/i", "/\\[size=(\\d{1,2}(\\.\\d{1,2}+)?(px|pt)+?)\\]/i", "/\\[font=([^\\[\\<]+?)\\]/i", "/\\[align=(left|center|right)\\]/i", "/\\[p=(\\d{1,2}|null), (\\d{1,2}), (left|center|right)\\]/i", "/\\[float=(left|right)\\]/i"), array("<font color=\"\\1\">", "<font style=\"color:\\1\">", "<font size=\"\\1\">", "<font style=\"font-size: \\1\">", "<font face=\"\\1 \">", "<p align=\"\\1\">", "<p style=\"line-height: \\1px; text-indent: \\2em; text-align: \\3;\">", "<span style=\"float: \\1;\">"), $message));
if ($parsetype != 1) {
if (strpos($msglower, '[/quote]') !== FALSE) {
$message = preg_replace("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", tpl_quote(), $message);
}
if (strpos($msglower, '[/free]') !== FALSE) {
$message = preg_replace("/\\s*\\[free\\][\n\r]*(.+?)[\n\r]*\\[\\/free\\]\\s*/is", tpl_free(), $message);
}
}
if (strpos($msglower, '[/media]') !== FALSE) {
$message = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", $allowmediacode ? "parsemedia('\\1', '\\2')" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message);
}
if (strpos($msglower, '[/audio]') !== FALSE) {
$message = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", $allowmediacode ? "parseaudio('\\2', 400, '\\1')" : "bbcodeurl('\\2', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message);
}
if (strpos($msglower, '[/flash]') !== FALSE) {
$message = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", $allowmediacode ? "parseflash('\\2', '\\3', '\\4');" : "bbcodeurl('\\4', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", $message);
}
if ($parsetype != 1 && $allowbbcode < 0 && isset($_G['cache']['bbcodes'][-$allowbbcode])) {
$message = preg_replace($_G['cache']['bbcodes'][-$allowbbcode]['searcharray'], $_G['cache']['bbcodes'][-$allowbbcode]['replacearray'], $message);
}
if ($parsetype != 1 && strpos($msglower, '[/hide]') !== FALSE && $pid) {
if (strpos($msglower, '[hide]') !== FALSE) {
if ($authorreplyexist === null) {
$posttable = getposttablebytid($_G['tid']);
$authorreplyexist = !$_G['forum']['ismoderator'] ? DB::result_first("SELECT pid FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND " . ($_G['uid'] ? "authorid='{$_G['uid']}'" : "authorid=0 AND useip='{$_G['clientip']}'") . " LIMIT 1") : TRUE;
}
if ($authorreplyexist) {
$message = preg_replace("/\\[hide\\]\\s*(.+?)\\s*\\[\\/hide\\]/is", tpl_hide_reply(), $message);
} else {
$message = preg_replace("/\\[hide\\](.+?)\\[\\/hide\\]/is", tpl_hide_reply_hidden(), $message);
$message .= '<script type="text/javascript">replyreload += \',\' + ' . $pid . ';</script>';
}
}
if (strpos($msglower, '[hide=') !== FALSE) {
$message = preg_replace("/\\[hide=(\\d+)\\]\\s*(.+?)\\s*\\[\\/hide\\]/ies", "creditshide(\\1,'\\2', {$pid})", $message);
}
}
}
if (!$bbcodeoff) {
if ($parsetype != 1 && strpos($msglower, '[swf]') !== FALSE) {
$message = preg_replace("/\\[swf\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/swf\\]/ies", "bbcodeurl('\\1', ' <img src=\"'.STATICURL.'image/filetype/flash.gif\" align=\"absmiddle\" alt=\"\" /> <a href=\"{url}\" target=\"_blank\">Flash: {url}</a> ')", $message);
}
if (strpos($msglower, '[/img]') !== FALSE) {
$message = preg_replace(array("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies", "/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/ies"), $allowimgcode ? array("bbcodeurl('\\1', '<img src=\"{url}\" onload=\"thumbImg(this)\" alt=\"\" />')", "parseimg('\\1', '\\2', '\\3')") : array("bbcodeurl('\\1', '<a href=\"{url}\" target=\"_blank\">{url}</a>')", "bbcodeurl('\\3', '<a href=\"{url}\" target=\"_blank\">{url}</a>')"), $message);
}
}
for ($i = 0; $i <= $_G['forum_discuzcode']['pcodecount']; $i++) {
$message = str_replace("[\tDISCUZ_CODE_{$i}\t]", $_G['forum_discuzcode']['codehtml'][$i], $message);
}
if (!empty($_G['gp_highlight'])) {
$highlightarray = explode('+', $_G['gp_highlight']);
$sppos = strrpos($message, chr(0) . chr(0) . chr(0));
if ($sppos !== FALSE) {
$specialextra = substr($message, $sppos + 3);
$message = substr($message, 0, $sppos);
}
$message = preg_replace(array("/(^|>)([^<]+)(?=<|\$)/sUe", "/<highlight>(.*)<\\/highlight>/siU"), array("highlight('\\2', \$highlightarray, '\\1')", "<strong><font color=\"#FF0000\">\\1</font></strong>"), $message);
if ($sppos !== FALSE) {
$message = $message . chr(0) . chr(0) . chr(0) . $specialextra;
}
}
unset($msglower);
//.........这里部分代码省略.........
示例10: array
$commentlist = $org = array();
if ($article['id'] && $article['idtype']) {
if ($article['idtype'] == 'blogid') {
$org = db::fetch_first("SELECT * FROM " . db::table('home_blog') . " WHERE blogid='{$article['id']}'");
$common_url = "home.php?mod=space&uid={$org['uid']}&do=blog&id={$article['id']}";
$form_url = "home.php?mod=spacecp&ac=comment";
$article['commentnum'] = getcount('home_comment', array('id' => $article['id'], 'idtype' => 'blogid'));
$query = DB::query("SELECT authorid AS uid, author AS username, dateline, message\n\t\t\tFROM " . DB::table('home_comment') . " WHERE id='{$article['id']}' AND idtype='blogid' ORDER BY dateline DESC LIMIT 0,20");
while ($value = DB::fetch($query)) {
$commentlist[] = $value;
}
} else {
$common_url = "forum.php?mod=viewthread&tid={$article['id']}";
$form_url = "forum.php?mod=post&action=reply&tid={$article['id']}&replysubmit=yes&infloat=yes&handlekey=fastpost";
require_once libfile('function/discuzcode');
$posttable = getposttablebytid($article['id']);
$article['commentnum'] = getcount($posttable, array('tid' => $article['id'], 'first' => '0'));
$firstpost = DB::fetch_first("SELECT first, authorid AS uid, author AS username, dateline, message, smileyoff, bbcodeoff, htmlon, attachment, pid\n\t\t\tFROM " . DB::table($posttable) . " WHERE tid='{$article['id']}' AND first='1'");
if (!($org = $firstpost)) {
db::update('portal_article_title', array('id' => 0, 'idtype' => ''), array('aid' => $aid));
header("location: portal.php?mod=view&aid={$aid}");
exit;
}
$attachpids = -1;
$attachtags = $aimgs = array();
$firstpost['message'] = $content['content'];
if ($firstpost['attachment']) {
if ($_G['group']['allowgetattach']) {
$attachpids .= ",{$firstpost['pid']}";
if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $firstpost['message'], $matchaids)) {
$attachtags[$firstpost['pid']] = $matchaids[1];
示例11: array
}
$moderate = array();
$toforumallowspecial = array(1 => $toforum['allowpostspecial'] & 1, 2 => $toforum['allowpostspecial'] & 2, 3 => isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]) && $toforum['allowpostspecial'] & 4, 4 => $toforum['allowpostspecial'] & 8, 5 => $toforum['allowpostspecial'] & 16, 127 => $_G['setting']['threadplugins'] ? unserialize($toforum['threadplugin']) : array());
foreach ($threadlist as $tid => $thread) {
$allowmove = 0;
if ($thread['closed']) {
continue;
}
if (!$thread['special']) {
$allowmove = 1;
} else {
if ($thread['special'] != 127) {
$allowmove = $toforum['allowpostspecial'] ? $toforumallowspecial[$thread['special']] : 0;
} else {
if ($toforumallowspecial[127]) {
$posttable = getposttablebytid($thread['tid']);
$message = DB::result_first("SELECT message FROM " . DB::table($posttable) . " WHERE tid='{$thread['tid']}' AND first='1'");
$sppos = strrpos($message, chr(0) . chr(0) . chr(0));
$specialextra = substr($message, $sppos + 3);
$allowmove = in_array($specialextra, $toforumallowspecial[127]);
} else {
$allowmove = 0;
}
}
}
if ($allowmove) {
$moderate[] = $tid;
$thread = daddslashes($thread, 1);
DB::query("INSERT INTO " . DB::table('forum_thread') . " (fid, readperm, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, special, attachment, isgroup)\r\n\t\t\t\t\t\t\tVALUES ('{$moveto}', '{$thread['readperm']}', '" . addslashes($thread['author']) . "', '{$thread['authorid']}', '" . addslashes($thread['subject']) . "', '{$thread['dateline']}', '" . TIMESTAMP . "', '" . addslashes($thread['lastposter']) . "', '{$thread['views']}', '{$thread['replies']}', '0', '{$thread['digest']}', '{$thread['tid']}', '{$thread['special']}', '{$thread['attachment']}', '{$thread['isgroup']}')");
$newtid = DB::insert_id();
DB::query("UPDATE " . DB::table('forum_thread') . " SET closed='{$newtid}' WHERE tid='{$thread['tid']}'");
示例12: exit
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: topicadmin_getip.php 20099 2011-02-15 01:55:29Z monkey $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if (!$_G['group']['allowviewip']) {
showmessage('no_privilege_viewip');
}
$pid = $_G['gp_pid'];
$posttable = getposttablebytid($_G['tid']);
$member = DB::fetch_first("SELECT m.adminid, p.first, p.useip FROM " . DB::table($posttable) . " p\r\n\t\t\tLEFT JOIN " . DB::table('common_member') . " m ON m.uid=p.authorid\r\n\t\t\tWHERE p.pid='{$pid}' AND p.tid='{$_G['tid']}'");
if (!$member) {
showmessage('thread_nonexistence', NULL);
} elseif ($member['adminid'] == 1 && $_G['adminid'] > 1 || $member['adminid'] == 2 && $_G['adminid'] > 2) {
showmessage('admin_getip_nopermission', NULL);
}
$member['iplocation'] = convertip($member['useip']);
include template('forum/topicadmin_getip');
示例13: str_replace
$_G['connect']['is_oauth_user'] = true;
if (empty($_G['member']['conuinsecret'])) {
$_G['connect']['is_oauth_user'] = false;
}
$referer = str_replace($_G['siteurl'], '', dreferer());
if (!empty($_G['gp_connect_autoshare'])) {
if (strpos($referer, '?') !== false) {
$referer .= '&connect_autoshare=1';
} else {
$referer .= '?connect_autoshare=1';
}
}
$_G['connect']['loginbind_url'] = $_G['siteurl'] . 'connect.php?mod=login&op=init&type=loginbind&referer=' . urlencode($_G['connect']['referer'] ? $_G['connect']['referer'] : 'index.php');
} elseif ($pluginop == 'share') {
$_G['gp_share_url'] = $_G['connect']['discuz_new_share_url'];
$posttable = getposttablebytid($tid);
$post = DB::fetch_first("SELECT * FROM " . DB::table($posttable) . " WHERE tid = '{$tid}' AND first='1' AND invisible='0'");
$thread = DB::fetch_first("SELECT * FROM " . DB::table('forum_thread') . " WHERE tid = '{$tid}' AND displayorder >= 0");
if ($_G['group']['allowgetimage'] && $thread['price'] == 0) {
connect_parse_bbcode($post['message'], $thread['fid'], $post['pid'], $post['htmlon'], $attach_images);
if ($attach_images && is_array($attach_images)) {
$_G['gp_share_images'] = array_slice($attach_images, 0, 3);
$attach_images = array();
foreach ($_G['gp_share_images'] as $image) {
$attach_images[] = $image['big'];
}
$_G['gp_attach_image'] = implode('|', $attach_images);
unset($attach_images);
}
}
} elseif ($pluginop == 'new') {
示例14: create_position
function create_position(&$select, $lastpid = 0)
{
if (empty($select) || !is_array($select)) {
return 0;
}
$tid = $select[0];
if (empty($lastpid)) {
$check = DB::result_first("SELECT tid FROM " . DB::table('forum_postposition') . " WHERE tid='{$tid}' LIMIT 1");
if ($check) {
unset($select[0]);
return 0;
}
}
$round = 500;
$posttable = getposttablebytid($tid);
$query = DB::query("SELECT pid FROM " . DB::table($posttable) . " WHERE tid='{$tid}' AND pid>'{$lastpid}' ORDER BY pid ASC LIMIT 0, {$round}");
while ($post = DB::fetch($query)) {
if (empty($post) || empty($post['pid'])) {
continue;
}
savepostposition($tid, $post['pid']);
$lastid = $post['pid'];
}
if (DB::num_rows($query) < $round) {
DB::query("UPDATE " . DB::table('forum_thread') . " SET status=status | '1' WHERE tid='{$tid}'");
unset($select[0]);
return 0;
} else {
return $lastid;
}
}
示例15: elseif
} elseif ($_G['gp_action'] == 'getimage') {
$_G['gp_aid'] = intval($_G['gp_aid']);
$image = DB::fetch_first('SELECT * FROM ' . DB::table(getattachtablebyaid($_G['gp_aid'])) . " WHERE aid='{$_G['gp_aid']}' AND isimage='1'");
include template('common/header_ajax');
if ($image['aid']) {
echo '<img src="' . getforumimg($image['aid'], 1, 300, 300, 'fixnone') . '" id="image_' . $image['aid'] . '" onclick="insertAttachimgTag(\'' . $image['aid'] . '\')" width="' . ($image['width'] < 110 ? $image['width'] : 110) . '" cwidth="' . ($image['width'] < 300 ? $image['width'] : 300) . '" />';
}
include template('common/footer_ajax');
dexit();
} elseif ($_G['gp_action'] == 'setthreadcover') {
$aid = intval($_G['gp_aid']);
require_once libfile('function/post');
if ($_G['forum'] && $aid) {
$threadimage = DB::fetch_first("SELECT tid, pid, attachment, remote FROM " . DB::table(getattachtablebyaid($aid)) . " WHERE aid='{$aid}'");
if ($threadimage['tid'] && $threadimage['pid']) {
$firstpost = DB::result_first("SELECT first FROM " . DB::table(getposttablebytid($threadimage['tid'])) . " WHERE pid='{$threadimage['pid']}'");
if (empty($firstpost)) {
$trade_aid = DB::result_first("SELECT aid FROM " . DB::table('forum_trade') . " WHERE pid='{$threadimage['pid']}'");
if ($trade_aid == $aid) {
$firstpost = 1;
}
}
} else {
$firstpost = 0;
}
if (empty($firstpost)) {
showmessage('set_cover_faild', '', array(), array('closetime' => 3));
}
if (setthreadcover(0, 0, $aid)) {
$threadimage = daddslashes($threadimage);
DB::delete('forum_threadimage', "tid='{$threadimage['tid']}'");