<?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.exp,g.gid,g.type,g.weight,g.gg,g.rotate_cl,g.slide_interval,g.time_cl,g.time_content,g.limit_gg,g.limit_gg_num,g.limit_visitor,g.visitor_num,g.os_cl,g.os_content,g.screen_cl,g.screen_content,g.browser_cl,g.browser_content,g.lang_cl,g.lang_content,g.referer_cl,g.referer_content,g.url_cl,g.url_content,g.local_cl,g.local_content,g.ua_cl,g.ua_content,g.lei_id,g.zu_id,g.recycle "
            . "FROM ${cfg_dbprefix}ggcl 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=2 AND z.type=2 AND l.lb_id=${adminLBID} AND z.lb_id=${adminLBID};";
} elseif ($adminPowerLB == 0) {
    $query = "SELECT g.title,g.exp,g.gid,g.type,g.weight,g.gg,g.rotate_cl,g.slide_interval,g.time_cl,g.time_content,g.limit_gg,g.limit_gg_num,g.limit_visitor,g.visitor_num,g.os_cl,g.os_content,g.screen_cl,g.screen_content,g.browser_cl,g.browser_content,g.lang_cl,g.lang_content,g.referer_cl,g.referer_content,g.url_cl,g.url_content,g.local_cl,g.local_content,g.ua_cl,g.ua_content,g.lei_id,g.zu_id,g.recycle "
            . "FROM ${cfg_dbprefix}ggcl AS g "
            . "WHERE g.id=$id AND g.admin_id='${adminID}';";
} else {
    $query = "SELECT g.title,g.exp,g.gid,g.type,g.weight,g.gg,g.rotate_cl,g.slide_interval,g.time_cl,g.time_content,g.limit_gg,g.limit_gg_num,g.limit_visitor,g.visitor_num,g.os_cl,g.os_content,g.screen_cl,g.screen_content,g.browser_cl,g.browser_content,g.lang_cl,g.lang_content,g.referer_cl,g.referer_content,g.url_cl,g.url_content,g.local_cl,g.local_content,g.ua_cl,g.ua_content,g.lei_id,g.zu_id,g.recycle "
            . "FROM ${cfg_dbprefix}ggcl AS g "
            . "WHERE g.id=$id;";
}
if (!(list($ggclTitle, $ggclExplain, $gid, $ggclType, $ggclWeight, $gg, $rotate_cl, $slide_interval, $time_cl, $time_content, $limit_gg, $limit_gg_num, $limit_visitor, $visitor_num, $os_cl, $os_content, $screen_cl, $screen_content, $browser_cl, $browser_content, $lang_cl, $lang_content, $referer_cl, $referer_content, $url_cl, $url_content, $local_cl, $local_content, $ua_cl, $ua_content, $lei_id, $zu_id, $recycle) = $nxsql->oneRowVal($query))) {
    errWin("未找到符合条件的广告策略ID：" . $id);
}
if ($menu != 'submit') {
    $title = $copy ? '复制广告策略' : '修改广告策略';
    $ggclTitle = $copy ? $ggclTitle . '_副本' . date("Y-m-d H:i:s") : $ggclTitle;
    $limit_gg_num = $limit_gg_num ? $limit_gg_num : '';
    $visitor_num = $visitor_num ? $visitor_num : '';
    $ggclLeiSelectList = getLeiSelectList(2, $adminID, $adminPowerLB, $adminLBID, $lei_id);
    $ggclZuSelectList = getZuSelectList(2, $adminID, $adminPowerLB, $adminLBID, $zu_id);
}
