⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func_forum_post.php

📁 采用模块化设计,自由组合文章,软件,论坛等模块,安装方便快捷 模板支持Dreamweaver可视化编辑,创建风格更为容易,专业
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php

if (!defined('ROOT'))
    exit('Access Denied');
function forum_t_select($tid, $t = 'tl')
{
    $db = db::getinstance();
    if (($t == 'tl' || $t == 't') && false === ($row = $db->fetch_first("select a.*,b.* from " .
        PF . "forum_titles as a LEFT JOIN " . PF .
        "center_titles as b on a.tid=b.tid where a.tid='$tid' && b.lid<1")))
    {
        if (($t == 'tl' || $t == 'l') && false === ($row = $db->fetch_first("select a.*,a.title as title2,b.*,c.* from (" .
            PF . "forum_titles as a LEFT JOIN " . PF .
            "center_titles as b on a.tid=b.tid) LEFT JOIN " . PF .
            "center_titles as c on c.lid=b.tid where c.tid='$tid'")))
        {
            return false;
        }
    }
    return $row;
}
function forum_p_select($pid)
{
    $db = db::getinstance();
    return $db->fetch_first("select a.*,b.*,c.* from " . PF . "forum_titles as a, " .
        PF . "center_titles as b, " . PF . "center_posts as c where c.pid='$pid' and c.tid=b.tid and b.tid=a.tid");
}
function forum_t_insert($con, $pv = false)
{
    if (!empty($pv) && !forum_post_pv($con, 't_insert'))
        return false;
    $db = db::getinstance();
    call_func('forum_pv');
    $_pv = forum_pv($con['fid'], true);
    $con['f_top'] = $_pv['p5'] && !empty($_POST['f_top']) ? 1 : 0;
    $con['f_lock'] = $_pv['p6'] && !empty($_POST['f_lock']) ? 1 : 0;
    $con['cl_1'] = $_pv['p7'] && !empty($_POST['cl_1']) ? 1 : 0;
    $con['cl_2'] = $_pv['p8'] && !empty($_POST['cl_2']) ? 1 : 0;
    $con['cl_3'] = $_pv['p9'] && !empty($_POST['cl_3']) ? 1 : 0;
    $con['cl_4'] = $_pv['p10'] && !empty($_POST['cl_4']) ? 1 : 0;
    $con['cl_5'] = $_pv['p11'] && !empty($_POST['cl_5']) ? 1 : 0;
    $con['forum_sell'] = abs(intval($con['add']['forum_sell']));
    $con['forum_sell'] = $con['forum_sell'] > 99999 ? 99999 : $con['forum_sell'];
    $_content = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "", $con['content']);
    if (preg_match("/\s*\[sell\](.+?)\[\/sell\]\s*/is", $_content))
    {
        $con['forum_sell'] < 1 && $con['forum_sell'] = 1;
    } else
    {
        $con['forum_sell'] = 0;
    }
    $db->query("insert into " . PF .
        "forum_titles (fid,author,authorid,title,stitle,etime,tid,f_top,f_lock,sell,muser,cl_1,cl_2,cl_3,cl_4,cl_5) values('$con[fid]','$con[author]','$con[authorid]','$con[title]','$con[stitle]','$con[ptime]','$con[tid]','$con[f_top]','$con[f_lock]','$con[forum_sell]','','$con[cl_1]','$con[cl_2]','$con[cl_3]','$con[cl_4]','$con[cl_5]')");
    $db->query("update " . PF . "forum_lists set titles=titles+1 where fid='$con[fid]'");
    upcache('table', 'forum_lists', 'order by zu,xu');
    upcache('file','forum_' . $con['fid'] . '_t_news');
    return true;
}
function forum_t_update($con, $pv = false)
{
    if (!empty($pv))
    {
        if (false == forum_post_pv($con, 't_update'))
            return false;
    }
    $db = db::getinstance();
    call_func('forum_pv');
    $_pv = forum_pv($con['fid'], true);
    $con['f_top'] = $_pv['p5'] && !empty($_POST['f_top']) ? 1 : 0;
    $con['f_lock'] = $_pv['p6'] && !empty($_POST['f_lock']) ? 1 : 0;
    $con['cl_1'] = $_pv['p7'] && !empty($_POST['cl_1']) ? 1 : 0;
    $con['cl_2'] = $_pv['p8'] && !empty($_POST['cl_2']) ? 1 : 0;
    $con['cl_3'] = $_pv['p9'] && !empty($_POST['cl_3']) ? 1 : 0;
    $con['cl_4'] = $_pv['p10'] && !empty($_POST['cl_4']) ? 1 : 0;
    $con['cl_5'] = $_pv['p11'] && !empty($_POST['cl_5']) ? 1 : 0;
    $con['forum_sell'] = abs(intval($con['add']['forum_sell']));
    $con['forum_sell'] = $con['forum_sell'] > 99999 ? 99999 : $con['forum_sell'];
    $_content = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "", $con['content']);
    if (preg_match("/\s*\[sell\](.+?)\[\/sell\]\s*/is", $_content))
    {
        $con['forum_sell'] < 1 && $con['forum_sell'] = 1;
    } else
    {
        $con['forum_sell'] = 0;
    }
    $db->query("update " . PF . "forum_titles set title='$con[title]',stitle='$con[stitle]',f_top='$con[f_top]',f_lock='$con[f_lock]',sell='$con[forum_sell]',cl_1='$con[cl_1]',cl_2='$con[cl_2]',cl_3='$con[cl_3]',cl_4='$con[cl_4]',cl_5='$con[cl_5]' where tid='$con[tid]'");
    upcache('file','forum_' . $con['fid'] . '_t_news');
    return true;
}
function forum_t_delete($tid, $fid = false, $pv = false)
{
    if (empty($fid))
    {
        if (false === ($row = forum_t_select($tid)))
            return false;
        $fid = $row['fid'];
    }
    if (!empty($pv))
    {
        if (false == forum_post_pv(array('fid' => $fid), 't_delete'))
            return false;
    }
    $db = db::getinstance();
    $db->query("delete from " . PF . "forum_titles where tid='$tid'");
    $db->query("update " . PF . "forum_lists set titles=titles-'1' where fid='$fid'");
    upcache('table', 'forum_lists', 'order by zu,xu');
    upcache('file','forum_' . $fid . '_t_news');
    return true;
}
function forum_t_move($mppid, $con)
{
    $row = forum_t_select($con['tid'], 't');
    $fid = false === $row ? false : $row['fid'];
    if ($mppid > 0)
    {
        if ($fid != $mppid)
        {
            if ($fid === false)
            {
                $con['fid'] = $mppid;
                return forum_t_insert($con);
            } else
            {
                $db = db::getinstance();
                $db->query("update " . PF . "forum_lists set titles=titles-'1' where fid='$fid'");
                $db->query("update " . PF . "forum_titles set fid='$mppid' where tid='$con[tid]'");
                $db->query("update " . PF . "forum_lists set titles=titles+1 where fid='$mppid'");
                upcache('table', 'forum_lists', 'order by zu,xu');
                return false;
            }
        } else
            return true;
    } else
    {
        if ($fid > 0)
        {
            forum_t_delete($con['tid'], $fid);
        }
        return false;
    }
}
function forum_showmove($id, $type)
{
    global $tomod;
    if (false === ($data = read_table('forum_lists', 'order by zu,xu')))
        return false;
    if ($type == 1)
    {
        $fid = $id;
        if ($tomod == 'forum')
        {
            $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="0" disabled="disabled" />' .
                $GLOBALS['tpl']['鍙栨秷'] . '</span>';
            foreach ($data as $fid => $val)
            {
                if ($fid == $_fid)
                {
                    $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="' .
                        $_fid . '" checked="checked" /><strong>' . html($val['name']) .
                        '</strong></span>';
                } else
                {
                    $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="' .
                        $_fid . '" disabled="disabled" />' . html($val['name']) . '</span>';
                }
            }
        } else
        {
            $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="0" disabled="disabled" />' .
                $GLOBALS['tpl']['鍙栨秷'] . '</span>';
            foreach ($data as $_fid => $val)
            {
                $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="' .
                    $_fid . '"' . (forum_post_pv(array('fid' => $_fid), 't_insert') ? '' :
                    ' disabled="disabled"') . ' />' . html($val['name']) . '</span>';
            }
        }
    } else
        if ($type == 2)
        {
            if (false === ($row = forum_t_select($id)))
            {
                $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="0" checked="checked"/>' .
                    $GLOBALS['tpl']['鍙栨秷'] . '</span>';
                foreach ($data as $_fid => $val)
                {
                    $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="' .
                        $_fid . '"' . (forum_post_pv(array('fid' => $_fid), 't_insert') ? '' :
                        ' disabled="disabled"') . ' />' . html($val['name']) . '</span>';
                }
            } else
            {
                $fid = $row['fid'];
                if (forum_post_pv(array('fid' => $fid), 't_delete'))
                {
                    $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="0" />' .
                        $GLOBALS['tpl']['鍙栨秷'] . '</span>';
                    foreach ($data as $_fid => $val)
                    {
                        if ($fid == $_fid)
                        {
                            $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[forum] value="' .
                                $_fid . '" checked="checked" /><strong>' . html($val['name']) .

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -