Exemplo n.º 1
0
<?php

/*
	[Discuz!] (C)2001-2007 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: post.php 10215 2007-08-25 01:08:25Z liuqiang $
*/
define('CURSCRIPT', 'post');
define('NOROBOT', TRUE);
require_once './include/common.inc.php';
require_once DISCUZ_ROOT . './include/post.func.php';
$_DTYPE = $checkoption = $optionlist = array();
if ($typeid) {
    threadtype_checkoption();
}
if (empty($action)) {
    showmessage('undefined_action', NULL, 'HALTED');
} elseif ($action == 'smilies' && $smileyinsert) {
    $smile = isset($_DCOOKIE['smile']) ? explode('D', $_DCOOKIE['smile']) : array();
    $stypeid = intval($stypeid ? $stypeid : $smile[0]);
    $stypeid = isset($_DCACHE['smileytypes'][$stypeid]) ? $stypeid : (isset($_DCACHE['smileytypes'][STYPEID]) ? STYPEID : key($_DCACHE['smileytypes']));
    $smilies = $_DCACHE['smilies_display'][$stypeid];
    $page = max(1, intval(isset($_GET['page']) ? $_GET['page'] : (!isset($_GET['stypeid']) || $_GET['stypeid'] == $smile[0] ? $smile[1] : 1)));
    $spp = $smcols * $smrows;
    $multipage = multi(count($smilies), $spp, $page, 'post.php?action=smilies&stypeid=' . $stypeid . '&inajax=1', 0, 10, FALSE, TRUE);
    $smilies = arrayslice($smilies, $spp * ($page - 1), $spp);
    dsetcookie('smile', $stypeid . 'D' . $page, 86400 * 365);
    include template('post_smilies');
    exit;
} elseif ($action == 'threadtypes') {
Exemplo n.º 2
0
            }
            if (!$tagstatus) {
                $db->query("INSERT {$tablepre}threadtags (tagname, tid) VALUES ('{$tagname}', {$tid})", 'UNBUFFERED');
            }
            $tagcount++;
            if ($tagcount > 4) {
                unset($tagarray);
                break;
            }
        }
    }
}
$pinvisible = $modnewreplies ? -2 : 0;
$db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)\r\n\t\tVALUES ('{$fid}', '{$tid}', '0', '{$discuz_user}', '{$discuz_uid}', '{$subject}', '{$timestamp}', '{$message}', '{$onlineip}', '{$pinvisible}', '{$isanonymous}', '{$usesig}', '{$htmlon}', '{$bbcodeoff}', '{$smileyoff}', '{$parseurloff}', '{$attachment}')");
$pid = $db->insert_id();
threadtype_checkoption(1, 1);
$optiondata = array();
if ($tradetypes && $typeoption && $checkoption) {
    $optiondata = threadtype_validator($typeoption);
}
if ($tradetypes && $optiondata) {
    foreach ($optiondata as $optionid => $value) {
        $db->query("INSERT INTO {$tablepre}tradeoptionvars (typeid, pid, optionid, value)\r\n\t\t\tVALUES ('{$tradetypeid}', '{$pid}', '{$optionid}', '{$value}')");
    }
}
$tradeaid = 0;
if ($attachment) {
    $searcharray = $pregarray = $replacearray = array();
    foreach ($attachments as $key => $attach) {
        $db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote)\r\n\t\t\tVALUES ('{$tid}', '{$pid}', '{$timestamp}', '{$attach['perm']}', '{$attach['price']}', '{$attach['name']}', '{$attach['description']}', '{$attach['type']}', '{$attach['size']}', '{$attach['attachment']}', '0', '{$attach['isimage']}', '{$attach['uid']}', '{$attach['thumb']}', '{$attach['remote']}')");
        $searcharray[] = '[local]' . $localid[$key] . '[/local]';
Exemplo n.º 3
0
     } else {
         $pattachment = $db->result_first("SELECT aid FROM {$tablepre}attachments WHERE pid='{$pid}' LIMIT 1") ? 1 : 0;
     }
     if ($pattachment) {
         $tattachment = 1;
     } else {
         $tattachment = $db->result_first("SELECT a.aid 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();
     threadtype_checkoption($oldtypeid, 1);
     $optiondata = array();
     if ($tradetypes && $typeoption && is_array($typeoption) && $checkoption) {
         $optiondata = threadtype_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 (typeid, 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}'");