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

📄 func_adcode_post.php

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

if (!defined('ROOT'))
    exit('Access Denied');
function adcode_t_select($tid, $t = 'tl')
{
    $db = db::getinstance();
    if (($t == 'tl' || $t == 't') && false === ($row = $db->fetch_first("select a.*,b.* from " .
        PF . "adcode_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 . "adcode_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 adcode_p_select($pid)
{
    $db = db::getinstance();
    return $db->fetch_first("select a.*,b.*,c.* from " . PF . "adcode_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 adcode_t_insert($con, $pv = false)
{
    return false;
}
function adcode_t_move($mppid, $con)
{
    return false == adcode_t_select($con['tid'], 't') ? false : true;
}
function adcode_showmove($id, $type)
{
    global $tomod;
    if (false === ($data = read_table('adcode_lists', 'order by zu,xu')))
        return false;
    if ($type == 1)
    {
        $fid = $id;
        if ($tomod == 'adcode')
        {
            $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] 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[adcode] value="' .
                        $_fid . '" checked="checked" /><strong>' . html($val['name']) .
                        '</strong></span>';
                } else
                {
                    $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="' .
                        $_fid . '" disabled="disabled" />' . html($val['name']) . '</span>';
                }
            }
        } else
        {
            $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="0" disabled="disabled" />' .
                $GLOBALS['tpl']['鍙栨秷'] . '</span>';
            foreach ($data as $_fid => $val)
            {
                $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="' .
                    $_fid . '"' . (adcode_post_pv(array('fid' => $_fid), 't_insert') ? '' :
                    ' disabled="disabled"') . ' />' . html($val['name']) . '</span>';
            }
        }
    } else
        if ($type == 2)
        {
            if (false === ($row = adcode_t_select($id)))
            {
                $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="0" checked="checked"/>' .
                    $GLOBALS['tpl']['鍙栨秷'] . '</span>';
                foreach ($data as $_fid => $val)
                {
                    $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="' .
                        $_fid . '"' . (adcode_post_pv(array('fid' => $_fid), 't_insert') ? '' :
                        ' disabled="disabled"') . ' />' . html($val['name']) . '</span>';
                }
            } else
            {
                $fid = $row['fid'];
                if (adcode_post_pv(array('fid' => $fid), 't_delete'))
                {
                    $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="0" />' .
                        $GLOBALS['tpl']['鍙栨秷'] . '</span>';
                    foreach ($data as $_fid => $val)
                    {
                        if ($fid == $_fid)
                        {
                            $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="' .
                                $_fid . '" checked="checked" /><strong>' . html($val['name']) .
                                '</strong></span>';
                        } else
                        {
                            $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="' .
                                $_fid . '"' . (adcode_post_pv(array('fid' => $_fid), 't_insert') ? '' :
                                ' disabled="disabled"') . ' />' . html($val['name']) . '</span>';
                        }
                    }
                } else
                {
                    $str = '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] 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[adcode] value="' .
                                $_fid . '" disabled="disabled" checked="checked" /><strong>' . html($val['name']) .
                                '</strong></span>';
                        } else
                        {
                            $str .= '<span><input onclick="exchagneIt();return true;" type="radio" name=move[adcode] value="' .
                                $_fid . '" disabled="disabled" />' . html($val['name']) . '</span>';
                        }
                    }
                }
            }
        }
    return $str;
}
function adcode_p_insert($con = array())
{
    $db = db::getinstance();
    $db->query("update " . PF . "adcode_titles set etime='" . SYSTIME .
        "' where tid='$con[tid]'");
    return true;
}
function adcode_t_link($con, $pv = false)
{
    $db = db::getinstance();
    $db->query("update " . PF . "adcode_titles set etime='" . SYSTIME .
        "' where tid='$con[lid]'");
    return true;
}
function adcode_p_update()
{
    return true;
}
function adcode_t_update($con, $pv = false)
{
    if (!empty($pv))
    {
        if (false == adcode_post_pv($con, 't_update'))
            return false;
    }
    $db = db::getinstance();
    call_func('adcode_pv');
    $_pv = adcode_pv($con['fid'], true);
    $con['f_lock'] = $_pv['p3'] && $con['f_lock'] ? 1 : 0;
    $db->query("update " . PF . "adcode_titles set title='$con[title]',stitle='$con[stitle]',f_lock='$con[f_lock]' where tid='$con[tid]'");
    upcache('file', LANG . '_adcode_ad_' . $con['tid']);
    upcache('tpl');
    return true;
}
function adcode_t_delete($tid, $fid = false, $pv = false)
{
    return false;
}
function adcode_l_delete($lid, $tid = false, $fid = false, $pv = false)
{
    if (empty($tid) || empty($fid))
    {
        if (false === ($row = adcode_t_select($lid)))
            return false;
        if (empty($row['lid']))
            return false;
        $tid = $row['tid'];
        $fid = $row['fid'];
    }
    if (!empty($pv))
    {
        if (false == adcode_post_pv(array('fid' => $fid), 'l_delete'))
            return false;
    }
    $db = db::getinstance();
    $db->query("update " . PF . "center_titles set lid='0' where tid='$lid'");
    if (!$db->num_rows("select count(*) from " . PF . "center_titles where lid='$tid'"))
    {
        $db->query("update " . PF . "center_titles set f_link='0' where tid='$tid'");
    }
    return true;
}
function adcode_p_delete($pid, $fid = false, $pv = false)
{
    if (!empty($pv))
    {
        if (empty($fid))
        {
            if (false === ($row = adcode_p_select($pid)))
                return false;
            $fid = $row['fid'];
        }
        if (false == adcode_post_pv(array('fid' => $fid), 'p_delete'))
            return false;
    }
    delpid($pid);
}
function adcode_post_pv($row, $type, &$pv = false)
{
    call_func('adcode_pv');
    switch ($type)
    {
        case 't_delete':
            return false;
            break;
        case 'l_delete':
        case 'p_delete':
            if (false === ($pv = adcode_pv($row['fid'], true)))
                return false;
            return empty($pv['p4']) ? false:
            true;
            break;
        case 't_insert':
            return false;
            break;
        case 't_update':
            if (false === ($pv = adcode_pv($row['fid'], true)))
                return false;
            if ($GLOBALS['user']['uid'] == $row['authorid'] && $row['authorid'] > 0)
                return true;
            return empty($pv['p3']) ? false:
            true;
            break;
        case 'p_insert':
            if (false === ($pv = adcode_pv($row['fid'], true)))
                return false;
            return (empty($pv['p1']) || !empty($row['f_lock'])) ? false:
            true;
            break;
        case 't_link':
            return false;
            break;
        case 'p_update':
            if (false === ($pv = adcode_pv($row['fid'], true)))
                return false;
            if ($GLOBALS['user']['uid'] == $row['authorid'] && $row['authorid'] > 0)
                return true;
            return empty($pv['p3']) ? false:
            true;
            break;
        default:
            return false;
            break;
    }
}
function adcode_show($ps)
{
    $tid = $ps['tid'];
    $pid = $ps['pid'];
    $url = '';
    $db = db::getinstance();
    $conf = read_config('adcode_config');
    if (empty($pid))
    {
        $tids = array();
        $tids[0] = 0;
        $result = $db->query("select a.tid from " . PF .
            "adcode_titles as a ,(select fid from " . PF . "adcode_titles  where tid='$tid') as b where a.fid=b.fid order by a.id");
        while ($row = $db->fetch_array($result))
        {
            $tids[] = $row['tid'];
        }
        $key = array_search($tid, $tids);
        if (false === $key)
            return false;
        $conf[3] = intval($conf[3]);
        for ($i = 0, $fpage = 0; $i < $key; $i += $conf[3], $fpage++)
            ;
        return RT . '?mod=adcode&file=showps&tid=' . $tid . '&fpage=' . $fpage .
            '&toa=0';
    } else
    {
        $fpage = abs(intval($_GET['fpage']));
        $fpage < 1 && $fpage = 1;
        $pids = array();
        $pids[0] = '';
        $result = $db->query("select pid from " . PF . "center_posts where tid='$tid' order by ptime");
        while ($row = $db->fetch_array($result))
        {
            $pids[] = $row['pid'];
        }
        $key = array_search($pid, $pids);


        $tpage = 1;
        return RT . '?mod=adcode&file=showps&tid=' . $tid . '&fpage=' . $fpage .
            '&tpage=' . $tpage . '&toa=' . $key;
    }
}
function adcode_epost($con, $pv, $type)
{
    global $user;
    $tpl=LANG('forum','_post');
    if ($type > 2)
        return array();
    $_menujs = '';
    $_funjs = '';
    $_menulist = '';
    $_css = '';
    $_html = '';

    if ($pv['p3'])
        $_html .= '<p><label>'.$tpl['绂佹

⌨️ 快捷键说明

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