<?php

/*
 * ----------------------------------------------------
 * 程序名称: 牛叉广告管理系统(NiuXams)
 * 程序功能: 实现专业的广告投放、管理和统计等管理系统！
 * 程序开发: 牛叉软件(NiuXSoft.com)
 * 版权所有: [NiuXams] (C)2013-2099 NiuXSoft.com
 * 官方网站: www.niuxsoft.com  Email: niuxsoft@163.com
 * ----------------------------------------------------
 * 使用条款:
 * 1.为构建创新型经济社会,请尊重保护知识产权！
 * 2.该软件个人非商业用途免费使用.
 * 3.免费使用禁止修改版权信息和官方推广链接.
 * 4.禁止任何衍生版本.禁止任何非法修改源代码贩卖.
 * ----------------------------------------------------
 */

defined('NIUX_INCLUDED') or exit('Access Denied.');
if ($adminPowerLB == 1) {
    $query = "SELECT g.title,g.gid,g.type,g.ggcl,g.bjgg,g.lei_id,g.zu_id,g.width,g.height,g.recycle "
            . "FROM ${cfg_dbprefix}ggw AS g "
            . "INNER JOIN ${cfg_dbprefix}lei AS l ON g.lei_id=l.id "
            . "INNER JOIN ${cfg_dbprefix}zu AS z ON g.zu_id=z.id "
            . "WHERE g.id=$id AND l.type=3 AND z.type=3 AND l.lb_id=${adminLBID} AND z.lb_id=${adminLBID};";
} elseif ($adminPowerLB == 0) {
    $query = "SELECT g.title,g.gid,g.type,g.ggcl,g.bjgg,g.lei_id,g.zu_id,g.width,g.height,g.recycle "
            . "FROM ${cfg_dbprefix}ggw AS g "
            . "WHERE g.id=$id AND g.admin_id='${adminID}';";
} else {
    $query = "SELECT g.title,g.gid,g.type,g.ggcl,g.bjgg,g.lei_id,g.zu_id,g.width,g.height,g.recycle "
            . "FROM ${cfg_dbprefix}ggw AS g "
            . "WHERE g.id=$id;";
}
if (!(list($ggwTitle, $gid, $ggwType, $ggcl, $bjgg, $lei_id, $zu_id, $ggwWidth, $ggwHeight, $recycle) = $nxsql->oneRowVal($query))) {
    errWin("未找到符合条件的广告位ID：" . $id);
}
if ($menu != 'submit') {
    $title = $copy ? '复制广告位' : '修改广告位';
    $ggwTitle = $copy ? $ggwTitle . '_副本' . date("Y-m-d H:i:s") : $ggwTitle;
    $ggwWidth = $ggwWidth ? $ggwWidth : '';
    $ggwHeight = $ggwHeight ? $ggwHeight : '';
    $ggwLeiSelectList = getLeiSelectList(3, $adminID, $adminPowerLB, $adminLBID, $lei_id);
    $ggwZuSelectList = getZuSelectList(3, $adminID, $adminPowerLB, $adminLBID, $zu_id);
}
