Esempio n. 1
0
function insertpost($data)
{
    if (isset($data['tid'])) {
        $tableid = DB::result_first("SELECT posttableid FROM " . DB::table('forum_thread') . " WHERE tid='{$data['tid']}'");
    } else {
        $tableid = getposttableid('p');
        $data['tid'] = 0;
    }
    $pid = DB::insert('forum_post_tableid', array('pid' => null), true);
    if (!$tableid) {
        $tablename = 'forum_post';
    } else {
        $tablename = "forum_post_{$tableid}";
    }
    $data = array_merge($data, array('pid' => $pid));
    DB::insert($tablename, $data);
    if ($pid % 1024 == 0) {
        DB::delete('forum_post_tableid', "pid<{$pid}");
    }
    save_syscache('max_post_id', $pid);
    return $pid;
}
Esempio n. 2
0
if (($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && is_array($_FILES['attach'])) {
    foreach ($_FILES['attach']['name'] as $attachname) {
        if ($attachname != '') {
            checklowerlimit('postattach');
            break;
        }
    }
}
$typeid = isset($typeid) ? $typeid : 0;
$displayorder = $modnewthreads ? -2 : ($_G['forum']['ismoderator'] && !empty($_G['gp_sticktopic']) ? 1 : 0);
$digest = $_G['forum']['ismoderator'] && !empty($addtodigest) ? 1 : 0;
$readperm = $_G['group']['allowsetreadperm'] ? $readperm : 0;
$isanonymous = $_G['gp_isanonymous'] && $_G['group']['allowanonymous'] ? 1 : 0;
$author = !$isanonymous ? $_G['username'] : '';
$moderated = $digest || $displayorder > 0 ? 1 : 0;
$posttableid = getposttableid('p');
$isgroup = $_G['forum']['status'] == 3 ? 1 : 0;
DB::query("INSERT INTO " . DB::table('forum_thread') . " (fid, posttableid, readperm, price, typeid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, moderated, replies, status, isgroup)\n\tVALUES ('{$_G['fid']}', '{$posttableid}', '{$readperm}', '{$price}', '{$typeid}', '{$author}', '{$_G['uid']}', '{$subject}', '{$_G['timestamp']}', '{$_G['timestamp']}', '{$author}', '{$displayorder}', '{$digest}', '{$special}', '{$attachment}', '{$moderated}', '1', '{$thread['status']}', '{$isgroup}')");
$tid = DB::insert_id();
if ($moderated) {
    updatemodlog($tid, $displayorder > 0 ? 'STK' : 'DIG');
    updatemodworks($displayorder > 0 ? 'STK' : 'DIG', 1);
}
$bbcodeoff = checkbbcodes($message, !empty($_G['gp_bbcodeoff']));
$smileyoff = checksmilies($message, !empty($_G['gp_smileyoff']));
$parseurloff = !empty($_G['gp_parseurloff']);
$htmlon = bindec(($_G['setting']['tagstatus'] && !empty($tagoff) ? 1 : 0) . ($_G['group']['allowhtml'] && !empty($_G['gp_htmlon']) ? 1 : 0));
$attentionon = empty($_G['gp_attention_add']) ? 0 : 1;
$pinvisible = $modnewthreads ? -2 : 0;
insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $_G['timestamp'], 'message' => '', 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $_G['gp_usesig'], 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0'));
if ($_G['setting']['tagstatus'] && $_G['gp_tags'] != '') {