[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 banner_manager.php

Zen Cart 源代码 banner_manager.php




下载文件

文件名: banner_manager.php
文件类型: PHP文件
文件大小: 36.02 KiB
MD5: 44dce6876d85a27e82a1fdf2b59f1fbf

banner_manager.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2010 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: banner_manager.php 15678 2010-03-16 02:34:53Z kuroi $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  13.  
  14.   $banner_extension = zen_banner_image_extension();
  15.  
  16.   if (zen_not_null($action)) {
  17.     switch ($action) {
  18.       case 'setflag':
  19.         if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
  20.           zen_set_banner_status($_GET['bID'], $_GET['flag']);
  21.  
  22.           $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success');
  23.         } else {
  24.           $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');
  25.         }
  26.  
  27.         zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']));
  28.         break;
  29.  
  30.       case 'setbanners_on_ssl':
  31.         if ( ($_GET['flagbanners_on_ssl'] == '0') || ($_GET['flagbanners_on_ssl'] == '1') ) {
  32.           $db->Execute("update " . TABLE_BANNERS . " set banners_on_ssl='" . $_GET['flagbanners_on_ssl'] . "' where banners_id='" . $_GET['bID'] . "'");
  33.  
  34.           $messageStack->add_session(SUCCESS_BANNER_ON_SSL_UPDATED, 'success');
  35.         } else {
  36.           $messageStack->add_session(ERROR_UNKNOWN_BANNER_ON_SSL, 'error');
  37.         }
  38.  
  39.         zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']));
  40.         break;
  41.       case 'setbanners_open_new_windows':
  42.         if ( ($_GET['flagbanners_open_new_windows'] == '0') || ($_GET['flagbanners_open_new_windows'] == '1') ) {
  43.           $db->Execute("update " . TABLE_BANNERS . " set banners_open_new_windows='" . $_GET['flagbanners_open_new_windows'] . "' where banners_id='" . $_GET['bID'] . "'");
  44.  
  45.           $messageStack->add_session(SUCCESS_BANNER_OPEN_NEW_WINDOW_UPDATED, 'success');
  46.         } else {
  47.           $messageStack->add_session(ERROR_UNKNOWN_BANNER_OPEN_NEW_WINDOW, 'error');
  48.         }
  49.  
  50.         zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']));
  51.         break;
  52.       case 'insert':
  53.       case 'update':
  54.         if (isset($_POST['banners_id'])) $banners_id = zen_db_prepare_input($_POST['banners_id']);
  55.         $banners_title = zen_db_prepare_input($_POST['banners_title']);
  56.         $banners_url = zen_db_prepare_input($_POST['banners_url']);
  57.         $new_banners_group = zen_db_prepare_input($_POST['new_banners_group']);
  58.         $banners_group = (empty($new_banners_group)) ? zen_db_prepare_input($_POST['banners_group']) : $new_banners_group;
  59.         $banners_html_text = zen_db_prepare_input($_POST['banners_html_text']);
  60.         $banners_image_local = zen_db_prepare_input($_POST['banners_image_local']);
  61.         $banners_image_target = zen_db_prepare_input($_POST['banners_image_target']);
  62.         $db_image_location = '';
  63.         $expires_date = zen_db_prepare_input($_POST['expires_date']) == '' ? 'null' : zen_date_raw($_POST['expires_date']);
  64.         $expires_impressions = zen_db_prepare_input($_POST['expires_impressions']);
  65.         $date_scheduled = zen_db_prepare_input($_POST['date_scheduled']) == '' ? 'null' : zen_date_raw($_POST['date_scheduled']);
  66.         $status = zen_db_prepare_input($_POST['status']);
  67.         $banners_open_new_windows = zen_db_prepare_input($_POST['banners_open_new_windows']);
  68.         $banners_on_ssl = zen_db_prepare_input($_POST['banners_on_ssl']);
  69.         $banners_sort_order = zen_db_prepare_input($_POST['banners_sort_order']);
  70.  
  71.         $banner_error = false;
  72.         if (empty($banners_title)) {
  73.           $messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error');
  74.           $banner_error = true;
  75.         }
  76.  
  77.         if (empty($banners_group)) {
  78.           $messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error');
  79.           $banner_error = true;
  80.         }
  81.  
  82.         if (empty($banners_html_text)) {
  83.           if (empty($banners_image_local)) {
  84.             $banners_image = new upload('banners_image');
  85.             $banners_image->set_destination(DIR_FS_CATALOG_IMAGES . $banners_image_target);
  86.             if ( ($banners_image->parse() == false) || ($banners_image->save() == false) ) {
  87.               $messageStack->add(ERROR_BANNER_IMAGE_REQUIRED, 'error');
  88.               $banner_error = true;
  89.             }
  90.           }
  91.         }
  92.  
  93.         if ($banner_error == false) {
  94.           $db_image_location = (zen_not_null($banners_image_local)) ? $banners_image_local : $banners_image_target . $banners_image->filename;
  95.           $sql_data_array = array('banners_title' => $banners_title,
  96.                                   'banners_url' => $banners_url,
  97.                                   'banners_image' => $db_image_location,
  98.                                   'banners_group' => $banners_group,
  99.                                   'banners_html_text' => $banners_html_text,
  100.                                   'status' => $status,
  101.                                   'banners_open_new_windows' => $banners_open_new_windows,
  102.                                   'banners_on_ssl' => $banners_on_ssl,
  103.                                   'banners_sort_order' => (int)$banners_sort_order);
  104.  
  105.           if ($action == 'insert') {
  106.             $insert_sql_data = array('date_added' => 'now()',
  107.                                      'status' => '1');
  108.  
  109.             $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  110.  
  111.             zen_db_perform(TABLE_BANNERS, $sql_data_array);
  112.  
  113.             $banners_id = zen_db_insert_id();
  114.  
  115.             $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
  116.           } elseif ($action == 'update') {
  117.             zen_db_perform(TABLE_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int)$banners_id . "'");
  118.  
  119.             $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
  120.           }
  121.  
  122. // NOTE: status will be reset by the /functions/banner.php
  123. // build new update sql for date_scheduled, expires_date and expires_impressions
  124.  
  125.           $sql = "UPDATE " . TABLE_BANNERS . "
  126.                  SET
  127.                    date_scheduled = :scheduledDate,
  128.                    expires_date = DATE_ADD(:expiresDate, INTERVAL '23:59:59' HOUR_SECOND),
  129.                    expires_impressions = " . ($expires_impressions == 0 ? "null" : ":expiresImpressions") . "
  130.                    WHERE banners_id = :bannersID";
  131.           if ($expires_impressions > 0) {
  132.             $sql = $db->bindVars($sql, ':expiresImpressions', $expires_impressions, 'integer');
  133.           }
  134.           if ($date_scheduled != '') {
  135.             $sql = $db->bindVars($sql, ':scheduledDate', $date_scheduled, 'date');
  136.           }
  137.           if ($expires_date != '') {
  138.             $sql = $db->bindVars($sql, ':expiresDate', $expires_date, 'date');
  139.           }
  140.             $sql = $db->bindVars($sql, ':bannersID', $banners_id, 'integer');
  141.             $db->Execute($sql);
  142.  
  143.           zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'bID=' . $banners_id));
  144.         } else {
  145.           $action = 'new';
  146.         }
  147.         break;
  148.       case 'deleteconfirm':
  149.         $banners_id = zen_db_prepare_input($_GET['bID']);
  150.  
  151.         if (isset($_POST['delete_image']) && ($_POST['delete_image'] == 'on')) {
  152.           $banner = $db->Execute("select banners_image
  153.                                 from " . TABLE_BANNERS . "
  154.                                 where banners_id = '" . (int)$banners_id . "'");
  155.  
  156.           if (is_file(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image'])) {
  157.             if (is_writeable(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image'])) {
  158.               unlink(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image']);
  159.             } else {
  160.               $messageStack->add_session(ERROR_IMAGE_IS_NOT_WRITEABLE, 'error');
  161.             }
  162.           } else {
  163.             $messageStack->add_session(ERROR_IMAGE_DOES_NOT_EXIST, 'error');
  164.           }
  165.         }
  166.  
  167.         $db->Execute("delete from " . TABLE_BANNERS . "
  168.                      where banners_id = '" . (int)$banners_id . "'");
  169.         $db->Execute("delete from " . TABLE_BANNERS_HISTORY . "
  170.                      where banners_id = '" . (int)$banners_id . "'");
  171.  
  172.         if (function_exists('imagecreate') && zen_not_null($banner_extension)) {
  173.           if (is_file(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) {
  174.             if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) {
  175.               unlink(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension);
  176.             }
  177.           }
  178.  
  179.           if (is_file(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) {
  180.             if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) {
  181.               unlink(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension);
  182.             }
  183.           }
  184.  
  185.           if (is_file(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) {
  186.             if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) {
  187.               unlink(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension);
  188.             }
  189.           }
  190.  
  191.           if (is_file(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) {
  192.             if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) {
  193.               unlink(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension);
  194.             }
  195.           }
  196.         }
  197.  
  198.         $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success');
  199.  
  200.         zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page']));
  201.         break;
  202.     }
  203.   }
  204.  
  205. // check if the graphs directory exists
  206.   $dir_ok = false;
  207.   if (function_exists('imagecreate') && zen_not_null($banner_extension)) {
  208.     if (is_dir(DIR_WS_IMAGES . 'graphs')) {
  209.       if (is_writeable(DIR_WS_IMAGES . 'graphs')) {
  210.         $dir_ok = true;
  211.       } else {
  212.         $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error');
  213.       }
  214.     } else {
  215.       $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error');
  216.     }
  217.   }
  218. ?>
  219. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  220. <html <?php echo HTML_PARAMS; ?>>
  221. <head>
  222. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  223. <title><?php echo TITLE; ?></title>
  224. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  225. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  226. <script language="javascript" src="includes/menu.js"></script>
  227. <script language="javascript" src="includes/general.js"></script>
  228. <script language="javascript"><!--
  229. function popupImageWindow(url) {
  230.   window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
  231. }
  232. //--></script>
  233. <script type="text/javascript">
  234.   <!--
  235.   function init()
  236.   {
  237.     cssjsmenu('navbar');
  238.     if (document.getElementById)
  239.     {
  240.       var kill = document.getElementById('hoverJS');
  241.       kill.disabled = true;
  242.     }
  243.   }
  244.   // -->
  245. </script>
  246. </head>
  247. <body onload="init()">
  248. <div id="spiffycalendar" class="text"></div>
  249. <!-- header //-->
  250. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  251. <!-- header_eof //-->
  252.  
  253. <!-- body //-->
  254. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  255.   <tr>
  256. <!-- body_text //-->
  257.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  258.       <tr>
  259.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  260.           <tr>
  261.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  262.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  263.           </tr>
  264.         </table></td>
  265.       </tr>
  266. <?php if ($action=='') { ?>
  267.       <tr>
  268.         <td><table border="0" cellspacing="0" cellpadding="0">
  269.           <tr>
  270.             <td class="smallText" align="center" width="100"><?php echo TEXT_LEGEND; ?></td>
  271.             <td class="smallText" align="center" width="100"><?php echo TEXT_LEGEND_STATUS_OFF . '<br />' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '&nbsp' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON); ?></td>
  272.             <td class="smallText" align="center" width="100"><?php echo TEXT_LEGEND_BANNER_ON_SSL . '<br />' . zen_image(DIR_WS_IMAGES . 'icon_blue_on.gif', IMAGE_ICON_BANNER_ON_SSL_ON) . '&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_blue_off.gif', IMAGE_ICON_BANNER_ON_SSL_OFF); ?></td>
  273.             <td class="smallText" align="center" width="100"><?php echo TEXT_LEGEND_BANNER_OPEN_NEW_WINDOWS . '<br />' . zen_image(DIR_WS_IMAGES . 'icon_orange_on.gif', IMAGE_ICON_BANNER_OPEN_NEW_WINDOWS_ON) . '&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_orange_off.gif', IMAGE_ICON_BANNER_OPEN_NEW_WINDOWS_OFF); ?></td>
  274.           </tr>
  275.         </table></td>
  276.       </tr>
  277. <?php } // legend ?>
  278. <?php
  279.   if ($action == 'new') {
  280.     $form_action = 'insert';
  281.  
  282.     $parameters = array('expires_date' => '',
  283.                         'date_scheduled' => '',
  284.                         'banners_title' => '',
  285.                         'banners_url' => '',
  286.                         'banners_group' => '',
  287.                         'banners_image' => '',
  288.                         'banners_html_text' => '',
  289.                         'expires_impressions' => '',
  290.                         'banners_open_new_windows' => '',
  291.                         'banners_on_ssl' => '');
  292.  
  293.     $bInfo = new objectInfo($parameters);
  294.  
  295.     if (isset($_GET['bID'])) {
  296.       $form_action = 'update';
  297.  
  298.       $bID = zen_db_prepare_input($_GET['bID']);
  299.  
  300.       $banner = $db->Execute("select banners_title, banners_url, banners_image, banners_group,
  301.                                     banners_html_text, status,
  302.                                     date_format(date_scheduled, '%Y/%m/%d') as date_scheduled,
  303.                                     date_format(expires_date, '%Y/%m/%d') as expires_date,
  304.                                     expires_impressions, date_status_change, banners_open_new_windows, banners_on_ssl, banners_sort_order
  305.                                     from " . TABLE_BANNERS . "
  306.                                     where banners_id = '" . (int)$bID . "'");
  307.  
  308.       $bInfo->objectInfo($banner->fields);
  309.     } elseif (zen_not_null($_POST)) {
  310.       $bInfo->objectInfo($_POST);
  311.     }
  312.  
  313.     if (!isset($bInfo->status)) $bInfo->status = '1';
  314.     switch ($bInfo->status) {
  315.       case '0': $is_status = false; $not_status = true; break;
  316.       case '1': $is_status = true; $not_status = false; break;
  317.       default: $is_status = true; $not_status = false; break;
  318.     }
  319.     if (!isset($bInfo->banners_open_new_windows)) $bInfo->banners_open_new_windows = '1';
  320.     switch ($bInfo->banners_open_new_windows) {
  321.       case '0': $is_banners_open_new_windows = false; $not_banners_open_new_windows = true; break;
  322.       case '1': $is_banners_open_new_windows = true; $not_banners_open_new_windows = false; break;
  323.       default: $is_banners_open_new_windows = true; $not_banners_open_new_windows = false; break;
  324.     }
  325.     if (!isset($bInfo->banners_on_ssl)) $bInfo->banners_on_ssl = '1';
  326.     switch ($bInfo->banners_on_ssl) {
  327.       case '0': $is_banners_on_ssl = false; $not_banners_on_ssl = true; break;
  328.       case '1': $is_banners_on_ssl = true; $not_banners_on_ssl = false; break;
  329.       default: $is_banners_on_ssl = true; $not_banners_on_ssl = false; break;
  330.     }
  331.  
  332.     $groups_array = array();
  333.     $groups = $db->Execute("select distinct banners_group
  334.                            from " . TABLE_BANNERS . "
  335.                            order by banners_group");
  336.     while (!$groups->EOF) {
  337.       $groups_array[] = array('id' => $groups->fields['banners_group'], 'text' => $groups->fields['banners_group']);
  338.       $groups->MoveNext();
  339.     }
  340. ?>
  341. <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
  342. <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
  343. <script language="javascript">
  344.   var dateExpires = new ctlSpiffyCalendarBox("dateExpires", "new_banner", "expires_date","btnDate1","<?php echo zen_date_short($bInfo->expires_date); ?>",scBTNMODE_CUSTOMBLUE);
  345.   var dateScheduled = new ctlSpiffyCalendarBox("dateScheduled", "new_banner", "date_scheduled","btnDate2","<?php echo zen_date_short($bInfo->date_scheduled); ?>",scBTNMODE_CUSTOMBLUE);
  346. </script>
  347.       <tr>
  348.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  349.       </tr>
  350.       <tr><?php echo zen_draw_form('new_banner', FILENAME_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'action=' . $form_action, 'post', 'enctype="multipart/form-data"'); if ($form_action == 'update') echo zen_draw_hidden_field('banners_id', $bID); ?>
  351.         <td><table border="0" cellspacing="0" cellpadding="2">
  352.           <tr>
  353.             <td class="main"><?php echo TEXT_BANNERS_STATUS; ?></td>
  354.             <td class="main"><?php echo zen_draw_radio_field('status', '1', $is_status) . '&nbsp;' . TEXT_BANNERS_ACTIVE . '&nbsp;' . zen_draw_radio_field('status', '0', $not_status) . '&nbsp;' . TEXT_BANNERS_NOT_ACTIVE . '<br />' . TEXT_INFO_BANNER_STATUS; ?></td>
  355.           </tr>
  356.           <tr>
  357.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  358.           </tr>
  359.           <tr>
  360.             <td class="main"><?php echo TEXT_BANNERS_OPEN_NEW_WINDOWS; ?></td>
  361.             <td class="main"><?php echo zen_draw_radio_field('banners_open_new_windows', '1', $is_banners_open_new_windows) . '&nbsp;' . TEXT_YES . '&nbsp;' . zen_draw_radio_field('banners_open_new_windows', '0', $not_banners_open_new_windows) . '&nbsp;' . TEXT_NO . '<br />' . TEXT_INFO_BANNER_OPEN_NEW_WINDOWS; ?></td>
  362.           </tr>
  363.           <tr>
  364.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  365.           </tr>
  366.           <tr>
  367.             <td class="main"><?php echo TEXT_BANNERS_ON_SSL; ?></td>
  368.             <td class="main"><?php echo zen_draw_radio_field('banners_on_ssl', '1', $is_banners_on_ssl) . '&nbsp;' . TEXT_YES . '&nbsp;' . zen_draw_radio_field('banners_on_ssl', '0', $not_banners_on_ssl) . '&nbsp;' . TEXT_NO . '<br />' . TEXT_INFO_BANNER_ON_SSL; ?></td>
  369.           </tr>
  370.           <tr>
  371.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  372.           </tr>
  373.           <tr>
  374.             <td class="main"><?php echo TEXT_BANNERS_TITLE; ?></td>
  375.             <td class="main"><?php echo zen_draw_input_field('banners_title', $bInfo->banners_title, zen_set_field_length(TABLE_BANNERS, 'banners_title'), true); ?></td>
  376.           </tr>
  377.           <tr>
  378.             <td class="main"><?php echo TEXT_BANNERS_URL; ?></td>
  379.             <td class="main"><?php echo zen_draw_input_field('banners_url', $bInfo->banners_url, zen_set_field_length(TABLE_BANNERS, 'banners_url')); ?></td>
  380.           </tr>
  381.           <tr>
  382.             <td class="main" valign="top"><?php echo TEXT_BANNERS_GROUP; ?></td>
  383.             <td class="main"><?php echo zen_draw_pull_down_menu('banners_group', $groups_array, $bInfo->banners_group) . TEXT_BANNERS_NEW_GROUP . '<br>' . zen_draw_input_field('new_banners_group', '', '', ((sizeof($groups_array) > 0) ? false : true)); ?></td>
  384.           </tr>
  385.           <tr>
  386.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  387.           </tr>
  388.           <tr>
  389.             <td class="main" valign="top"><?php echo TEXT_BANNERS_IMAGE; ?></td>
  390.             <td class="main"><?php echo zen_draw_file_field('banners_image') . ' ' . TEXT_BANNERS_IMAGE_LOCAL . '<br>' . DIR_FS_CATALOG_IMAGES . zen_draw_input_field('banners_image_local', (isset($bInfo->banners_image) ? $bInfo->banners_image : ''), zen_set_field_length(TABLE_BANNERS, 'banners_image')); ?></td>
  391.           </tr>
  392.           <tr>
  393.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  394.           </tr>
  395.           <tr>
  396.             <td class="main"><?php echo TEXT_BANNERS_IMAGE_TARGET; ?></td>
  397.             <td class="main"><?php echo DIR_FS_CATALOG_IMAGES . zen_draw_input_field('banners_image_target'); ?></td>
  398.           </tr>
  399.           <tr>
  400.             <td class="main" colspan="2"><?php echo TEXT_BANNER_IMAGE_TARGET_INFO; ?></td>
  401.           </tr>
  402.           <tr>
  403.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  404.           </tr>
  405.           <tr>
  406.             <td valign="top" class="main"><?php echo TEXT_BANNERS_HTML_TEXT; ?></td>
  407.             <td class="main"><?php echo TEXT_BANNERS_HTML_TEXT_INFO . '<br />' . zen_draw_textarea_field('banners_html_text', 'soft', '60', '5', $bInfo->banners_html_text); ?></td>
  408.           </tr>
  409.           <tr>
  410.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  411.           </tr>
  412.           <tr>
  413.             <td class="main"><?php echo TEXT_BANNERS_ALL_SORT_ORDER; ?></td>
  414.             <td class="main"><?php echo TEXT_BANNERS_ALL_SORT_ORDER_INFO . '<br />' . zen_draw_input_field('banners_sort_order', $bInfo->banners_sort_order, zen_set_field_length(TABLE_BANNERS, 'banners_sort_order'), false); ?></td>
  415.           </tr>
  416.           <tr>
  417.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  418.           </tr>
  419.           <tr>
  420.             <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?></td>
  421.             <td valign="top" class="main"><script language="javascript">dateScheduled.writeControl();dateScheduled.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td>
  422.           </tr>
  423.           <tr>
  424.             <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  425.           </tr>
  426.           <tr>
  427.             <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?></td>
  428.             <td class="main"><script language="javascript">dateExpires.writeControl();dateExpires.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script><?php echo TEXT_BANNERS_OR_AT . '<br>' . zen_draw_input_field('expires_impressions', $bInfo->expires_impressions, 'maxlength="7" size="7"') . ' ' . TEXT_BANNERS_IMPRESSIONS; ?></td>
  429.           </tr>
  430.         </table></td>
  431.       </tr>
  432.       <tr>
  433.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  434.       </tr>
  435.       <tr>
  436.         <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  437.           <tr>
  438.             <td class="main"><?php echo TEXT_BANNERS_BANNER_NOTE . '<br>' . TEXT_BANNERS_INSERT_NOTE . '<br>' . TEXT_BANNERS_EXPIRCY_NOTE . '<br>' . TEXT_BANNERS_SCHEDULE_NOTE; ?></td>
  439.             <td class="main" align="right" valign="top" nowrap><?php echo (($form_action == 'insert') ? zen_image_submit('button_insert.gif', IMAGE_INSERT) : zen_image_submit('button_update.gif', IMAGE_UPDATE)). '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . (isset($_GET['bID']) ? 'bID=' . $_GET['bID'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
  440.           </tr>
  441.         </table></td>
  442.       </form></tr>
  443. <?php
  444.   } else {
  445. ?>
  446.       <tr>
  447.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  448.           <tr>
  449.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  450.               <tr class="dataTableHeadingRow">
  451.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_BANNERS; ?></td>
  452.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_GROUPS; ?></td>
  453.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATISTICS; ?></td>
  454.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
  455.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_BANNER_OPEN_NEW_WINDOWS; ?></td>
  456.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_BANNER_ON_SSL; ?></td>
  457.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_BANNER_SORT_ORDER; ?></td>
  458.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  459.               </tr>
  460. <?php
  461. // Split Page
  462. // reset page when page is unknown
  463. if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['bID'] != '') {
  464.   $banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added, banners_open_new_windows, banners_on_ssl, banners_sort_order from " . TABLE_BANNERS . " order by banners_title, banners_group";
  465.   $check_page = $db->Execute($banners_query_raw);
  466.   $check_count=1;
  467.   if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
  468.     while (!$check_page->EOF) {
  469.       if ($check_page->fields['banners_id'] == $_GET['bID']) {
  470.         break;
  471.       }
  472.       $check_count++;
  473.       $check_page->MoveNext();
  474.     }
  475.     $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
  476.   } else {
  477.     $_GET['page'] = 1;
  478.   }
  479. }
  480.  
  481.     $banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added, banners_open_new_windows, banners_on_ssl, banners_sort_order from " . TABLE_BANNERS . " order by banners_title, banners_group";
  482.     $banners_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows);
  483.     $banners = $db->Execute($banners_query_raw);
  484.     while (!$banners->EOF) {
  485.       $info = $db->Execute("select sum(banners_shown) as banners_shown,
  486.                                   sum(banners_clicked) as banners_clicked
  487.                            from " . TABLE_BANNERS_HISTORY . "
  488.                            where banners_id = '" . (int)$banners->fields['banners_id'] . "'");
  489.  
  490.       if ((!isset($_GET['bID']) || (isset($_GET['bID']) && ($_GET['bID'] == $banners->fields['banners_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) {
  491.         $bInfo_array = array_merge($banners->fields, $info->fields);
  492.         $bInfo = new objectInfo($bInfo_array);
  493.       }
  494.  
  495.       $banners_shown = ($info->fields['banners_shown'] != '') ? $info->fields['banners_shown'] : '0';
  496.       $banners_clicked = ($info->fields['banners_clicked'] != '') ? $info->fields['banners_clicked'] : '0';
  497.  
  498.       if (isset($bInfo) && is_object($bInfo) && ($banners->fields['banners_id'] == $bInfo->banners_id)) {
  499.         echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $bInfo->banners_id . '&action=new') . '\'">' . "\n";
  500.       } else {
  501.         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id']) . '\'">' . "\n";
  502.       }
  503. ?>
  504.                 <td class="dataTableContent"><?php echo '<a href="javascript:popupImageWindow(\'' . FILENAME_POPUP_IMAGE . '.php' . '?banner=' . $banners->fields['banners_id']  . '\')">' . zen_image(DIR_WS_IMAGES . 'icon_popup.gif', 'View Banner') . '</a>&nbsp;' . $banners->fields['banners_title']; ?></td>
  505.                 <td class="dataTableContent" align="right"><?php echo $banners->fields['banners_group']; ?></td>
  506.                 <td class="dataTableContent" align="right"><?php echo $banners_shown . ' / ' . $banners_clicked; ?></td>
  507.                 <td class="dataTableContent" align="center">
  508. <?php
  509.       if ($banners->fields['status'] == '1') {
  510.         echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id'] . '&action=setflag&flag=0') . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>';
  511.       } else {
  512.         echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id'] . '&action=setflag&flag=1') . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>';
  513.       }
  514. ?>
  515.                 </td>
  516.                 <td class="dataTableContent" align="center">
  517. <?php
  518.       if ($banners->fields['banners_open_new_windows'] == '1') {
  519.         echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id'] . '&action=setbanners_open_new_windows&flagbanners_open_new_windows=0') . '">' . zen_image(DIR_WS_IMAGES . 'icon_orange_on.gif', IMAGE_ICON_BANNER_OPEN_NEW_WINDOWS_ON) . '</a>';
  520.       } else {
  521.         echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id'] . '&action=setbanners_open_new_windows&flagbanners_open_new_windows=1') . '">' . zen_image(DIR_WS_IMAGES . 'icon_orange_off.gif', IMAGE_ICON_BANNER_OPEN_NEW_WINDOWS_OFF) . '</a>';
  522.       }
  523. ?>
  524.                 </td>
  525.                 <td class="dataTableContent" align="center">
  526. <?php
  527.       if ($banners->fields['banners_on_ssl'] == '1') {
  528.         echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id'] . '&action=setbanners_on_ssl&flagbanners_on_ssl=0') . '">' . zen_image(DIR_WS_IMAGES . 'icon_blue_on.gif', IMAGE_ICON_BANNER_ON_SSL_ON) . '</a>';
  529.       } else {
  530.         echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id'] . '&action=setbanners_on_ssl&flagbanners_on_ssl=1') . '">' . zen_image(DIR_WS_IMAGES . 'icon_blue_off.gif', IMAGE_ICON_BANNER_ON_SSL_OFF) . '</a>';
  531.       }
  532. ?>
  533.                 </td>
  534.                 <td class="dataTableContent" align="right"><?php echo $banners->fields['banners_sort_order']; ?></td>
  535.  
  536.                 <td class="dataTableContent" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_BANNER_STATISTICS, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id']) . '">' . zen_image(DIR_WS_ICONS . 'statistics.gif', ICON_STATISTICS) . '</a>&nbsp;'; if (isset($bInfo) && is_object($bInfo) && ($banners->fields['banners_id'] == $bInfo->banners_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $banners->fields['banners_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  537.               </tr>
  538. <?php
  539.       $banners->MoveNext();
  540.     }
  541. ?>
  542.               <tr>
  543.                 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  544.                   <tr>
  545.                     <td class="smallText" valign="top"><?php echo $banners_split->display_count($banners_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_BANNERS); ?></td>
  546.                     <td class="smallText" align="right"><?php echo $banners_split->display_links($banners_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  547.                   </tr>
  548.                   <tr>
  549.                     <td align="right" colspan="2"><?php echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'action=new') . '">' . zen_image_button('button_new_banner.gif', IMAGE_NEW_BANNER) . '</a>'; ?></td>
  550.                   </tr>
  551.                 </table></td>
  552.               </tr>
  553.             </table></td>
  554. <?php
  555.   $heading = array();
  556.   $contents = array();
  557.   switch ($action) {
  558.     case 'delete':
  559.       $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>');
  560.  
  561.       $contents = array('form' => zen_draw_form('banners', FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $bInfo->banners_id . '&action=deleteconfirm'));
  562.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  563.       $contents[] = array('text' => '<br><b>' . $bInfo->banners_title . '</b>');
  564.       if ($bInfo->banners_image) $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_image', 'on', true) . ' ' . TEXT_INFO_DELETE_IMAGE);
  565.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  566.       break;
  567.     default:
  568.       if (is_object($bInfo)) {
  569.         $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>');
  570.  
  571.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $bInfo->banners_id . '&action=new') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $bInfo->banners_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  572.         $contents[] = array('text' => '<br>' . TEXT_BANNERS_DATE_ADDED . ' ' . zen_date_short($bInfo->date_added));
  573.         $contents[] = array('center', 'text' => '<br />' . '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $bInfo->banners_id) . '">' . zen_image_button('button_update.gif', IMAGE_UPDATE) . '</a>' );
  574.  
  575.         if ( (function_exists('imagecreate')) && ($dir_ok) && ($banner_extension) ) {
  576.           $banner_id = $bInfo->banners_id;
  577.           $days = '3';
  578.           include(DIR_WS_INCLUDES . 'graphs/banner_infobox.php');
  579.           $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banner_id . '.' . $banner_extension));
  580.         } else {
  581.           include(DIR_WS_FUNCTIONS . 'html_graphs.php');
  582.           $contents[] = array('align' => 'center', 'text' => '<br>' . zen_banner_graph_infoBox($bInfo->banners_id, '3'));
  583.         }
  584.  
  585.         $contents[] = array('text' => zen_image(DIR_WS_IMAGES . 'graph_hbar_blue.gif', 'Blue', '5', '5') . ' ' . TEXT_BANNERS_BANNER_VIEWS . '<br>' . zen_image(DIR_WS_IMAGES . 'graph_hbar_red.gif', 'Red', '5', '5') . ' ' . TEXT_BANNERS_BANNER_CLICKS);
  586.  
  587.         if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_SCHEDULED_AT_DATE, zen_date_short($bInfo->date_scheduled)));
  588.  
  589.         if ($bInfo->expires_date) {
  590.           $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_DATE, zen_date_short($bInfo->expires_date)));
  591.         } elseif ($bInfo->expires_impressions) {
  592.           $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions));
  593.         }
  594.  
  595.         if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_STATUS_CHANGE, zen_date_short($bInfo->date_status_change)));
  596.       }
  597.       break;
  598.   }
  599.  
  600.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  601.     echo '            <td width="25%" valign="top">' . "\n";
  602.  
  603.     $box = new box;
  604.     echo $box->infoBox($heading, $contents);
  605.  
  606.     echo '            </td>' . "\n";
  607.   }
  608. ?>
  609.           </tr>
  610.         </table></td>
  611.       </tr>
  612. <?php
  613.   }
  614. ?>
  615.     </table></td>
  616. <!-- body_text_eof //-->
  617.   </tr>
  618. </table>
  619. <!-- body_eof //-->
  620.  
  621. <!-- footer //-->
  622. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  623. <!-- footer_eof //-->
  624. <br>
  625. </body>
  626. </html>
  627. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>