<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php
  require('load_this/load_bigware_11.php');
  $action = (isset($_GET['action']) ? $_GET['action'] : '');
  $banner_extension = go_banner_picture_extension();
  if (go_not_null($action)) {
    switch ($action) {
      case 'setflag':
        if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
          go_set_banner_status($_GET['bigwareID'], $_GET['flag']);
          $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success');
        } else {
          $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');
        }
        go_forward(go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $_GET['bigwareID']));
        break;
      case 'insert':
      case 'update':
        if (isset($_POST['banners_id'])) $banners_id = go_db_producing_input($_POST['banners_id']);
        $banners_title = go_db_producing_input($_POST['banners_title']);
        $banners_url = go_db_producing_input($_POST['banners_url']);
        $new_banners_group = go_db_producing_input($_POST['new_banners_group']);
        $banners_group = (empty($new_banners_group)) ? go_db_producing_input($_POST['banners_group']) : $new_banners_group;
        $banners_html_text = go_db_producing_input($_POST['banners_html_text']);
        $banners_picture_local = go_db_producing_input($_POST['banners_picture_local']);
        $banners_picture_target = go_db_producing_input($_POST['banners_picture_target']);
        $db_picture_location = '';
        $expires_date = go_db_producing_input($_POST['expires_date']);
        $expires_impressions = go_db_producing_input($_POST['expires_impressions']);
        $date_scheduled = go_db_producing_input($_POST['date_scheduled']);
        $banner_error = false;
        if (empty($banners_title)) {
          $messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error');
          $banner_error = true;
        }
        if (empty($banners_group)) {
          $messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error');
          $banner_error = true;
        }
        if (empty($banners_html_text)) {
          if (empty($banners_picture_local)) {
            $banners_picture = new upload('banners_picture');
            $banners_picture->set_destination(FOLDER_ABSOLUT_CATALOG_PICTURES . $banners_picture_target);
            if ( ($banners_picture->parse() == false) || ($banners_picture->save() == false) ) {
              $banner_error = true;
            }
          }
        }
        if ($banner_error == false) {
          $db_picture_location = (go_not_null($banners_picture_local)) ? $banners_picture_local : $banners_picture_target . $banners_picture->filename;
          $sql_data_array = array('banners_title' => $banners_title,
                                  'banners_url' => $banners_url,
                                  'banners_picture' => $db_picture_location,
                                  'banners_group' => $banners_group,
                                  'banners_html_text' => $banners_html_text);
          if ($action == 'insert') {
            $insert_sql_data = array('date_added' => 'now()',
                                     'status' => '1');
            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
            go_db_carry(DB_TBL_BANNERS, $sql_data_array);
            $banners_id = go_db_insert_id();
            $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
          } elseif ($action == 'update') {
            go_db_carry(DB_TBL_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int)$banners_id . "'");
            $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
          }
          if (go_not_null($expires_date)) {
            list($day, $month, $year) = explode('/', $expires_date);
            $expires_date = $year .
                            ((strlen($month) == 1) ? '0' . $month : $month) .
                            ((strlen($day) == 1) ? '0' . $day : $day);
            go_db_query("update " . DB_TBL_BANNERS . " set expires_date = '" . go_db_input($expires_date) . "', expires_impressions = null where banners_id = '" . (int)$banners_id . "'");
          } elseif (go_not_null($expires_impressions)) {
            go_db_query("update " . DB_TBL_BANNERS . " set expires_impressions = '" . go_db_input($expires_impressions) . "', expires_date = null where banners_id = '" . (int)$banners_id . "'");
          }
          if (go_not_null($date_scheduled)) {
            list($day, $month, $year) = explode('/', $date_scheduled);
            $date_scheduled = $year .
                              ((strlen($month) == 1) ? '0' . $month : $month) .
                              ((strlen($day) == 1) ? '0' . $day : $day);
            go_db_query("update " . DB_TBL_BANNERS . " set status = '0', date_scheduled = '" . go_db_input($date_scheduled) . "' where banners_id = '" . (int)$banners_id . "'");
          }
          go_forward(go_href_link(NAME_OF_FILE_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'bigwareID=' . $banners_id));
        } else {
          $action = 'new';
        }
        break;
      case 'deleteconfirm':
        $banners_id = go_db_producing_input($_GET['bigwareID']);
        if (isset($_POST['delete_picture']) && ($_POST['delete_picture'] == 'on')) {
          $banner_query = go_db_query("select banners_picture from " . DB_TBL_BANNERS . " where banners_id = '" . (int)$banners_id . "'");
          $banner = go_db_fetch_array($banner_query);
          if (is_file(FOLDER_ABSOLUT_CATALOG_PICTURES . $banner['banners_picture'])) {
            if (is_writeable(FOLDER_ABSOLUT_CATALOG_PICTURES . $banner['banners_picture'])) {
              unlink(FOLDER_ABSOLUT_CATALOG_PICTURES . $banner['banners_picture']);
            } else {
              $messageStack->add_session(ERROR_PICTURE_IS_NOT_WRITEABLE, 'error');
            }
          } else {
            $messageStack->add_session(ERROR_PICTURE_DOES_NOT_EXIST, 'error');
          }
        }
        go_db_query("delete from " . DB_TBL_BANNERS . " where banners_id = '" . (int)$banners_id . "'");
        go_db_query("delete from " . DB_TBL_BANNERS_HISTORY . " where banners_id = '" . (int)$banners_id . "'");
        if (function_exists('imagecreate') && go_not_null($banner_extensio)) {
          if (is_file(FOLDER_RELATIV_PICTURES . 'graphs/banner_infoframe-' . $banners_id . '.' . $banner_extension)) {
            if (is_writeable(FOLDER_RELATIV_PICTURES . 'graphs/banner_infoframe-' . $banners_id . '.' . $banner_extension)) {
              unlink(FOLDER_RELATIV_PICTURES . 'graphs/banner_infoframe-' . $banners_id . '.' . $banner_extension);
            }
          }
          if (is_file(FOLDER_RELATIV_PICTURES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) {
            if (is_writeable(FOLDER_RELATIV_PICTURES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) {
              unlink(FOLDER_RELATIV_PICTURES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension);
            }
          }
          if (is_file(FOLDER_RELATIV_PICTURES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) {
            if (is_writeable(FOLDER_RELATIV_PICTURES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) {
              unlink(FOLDER_RELATIV_PICTURES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension);
            }
          }
          if (is_file(FOLDER_RELATIV_PICTURES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) {
            if (is_writeable(FOLDER_RELATIV_PICTURES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) {
              unlink(FOLDER_RELATIV_PICTURES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension);
            }
          }
        }
        $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success');
        go_forward(go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page']));
        break;
    }
  } 
  $dir_ok = false;
  if (function_exists('imagecreate') && go_not_null($banner_extension)) {
    if (is_dir(FOLDER_RELATIV_PICTURES . 'graphs')) {
      if (is_writeable(FOLDER_RELATIV_PICTURES . 'graphs')) {
        $dir_ok = true;
      } else {
        $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error');
      }
    } else {
      $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error');
    }
  }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="load_this/style.css">
<script language="javascript" src="load_this/menu.js"></script>
<script language="javascript" src="load_this/general.js"></script>
<script language="javascript"><!--
function popupImageWindow(url) {
  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')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo FRAME_WIDTH; ?>" valign="top">
<!-- left_navigation //-->
<!-- left_navigation_eof //-->
</td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageGeneralsign"><?php echo ABOVE_TITLE; ?></td>
            <td class="pageGeneralsign" align="right"><?php echo go_fetch_dividing_up('tranparentes.gif', ABOVE_PICTURE_WIDTH, ABOVE_PICTURE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
<?php
  if ($action == 'new') {
    $form_action = 'insert';
    $parameters = array('expires_date' => '',
                        'date_scheduled' => '',
                        'banners_title' => '',
                        'banners_url' => '',
                        'banners_group' => '',
                        'banners_picture' => '',
                        'banners_html_text' => '',
                        'expires_impressions' => '');
    $bInfo = new objectInfo($parameters);
    if (isset($_GET['bigwareID'])) {
      $form_action = 'update';
      $bigwareID = go_db_producing_input($_GET['bigwareID']);
      $banner_query = go_db_query("select banners_title, banners_url, banners_picture, banners_group, banners_html_text, status, date_format(date_scheduled, '%d/%m/%Y') as date_scheduled, date_format(expires_date, '%d/%m/%Y') as expires_date, expires_impressions, date_status_change from " . DB_TBL_BANNERS . " where banners_id = '" . (int)$bigwareID . "'");
      $banner = go_db_fetch_array($banner_query);
      $bInfo->objectInfo($banner);
    } elseif (go_not_null($_POST)) {
      $bInfo->objectInfo($_POST);
    }
    $groups_array = array();
    $groups_query = go_db_query("select distinct banners_group from " . DB_TBL_BANNERS . " order by banners_group");
    while ($groups = go_db_fetch_array($groups_query)) {
      $groups_array[] = array('id' => $groups['banners_group'], 'text' => $groups['banners_group']);
    }
?>
<link rel="stylesheet" type="text/css" href="load_this/javascript/spiffyCal/spiffyCal_v2_1.css">
<script language="JavaScript" src="load_this/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
<script language="javascript">
  var dateExpires = new ctlSpiffyCalendarBox("dateExpires", "new_banner", "expires_date","btnDate1","<?php echo $bInfo->expires_date; ?>",scBTNMODE_CUSTOMBLUE);
  var dateScheduled = new ctlSpiffyCalendarBox("dateScheduled", "new_banner", "date_scheduled","btnDate2","<?php echo $bInfo->date_scheduled; ?>",scBTNMODE_CUSTOMBLUE);
</script>
      <tr>
        <td><?php echo go_fetch_dividing_up('tranparentes.gif', '1', '10'); ?></td>
      </tr>
      <tr><?php echo go_fetch_form('new_banner', NAME_OF_FILE_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'action=' . $form_action, 'post', 'enctype="multipart/form-data"'); if ($form_action == 'update') echo go_fetch_hidden_field('banners_id', $bigwareID); ?>
        <td><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_TITLE; ?></td>
            <td class="main"><?php echo go_fetch_inputfeld('banners_title', $bInfo->banners_title, '', true); ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_URL; ?></td>
            <td class="main"><?php echo go_fetch_inputfeld('banners_url', $bInfo->banners_url); ?></td>
          </tr>
          <tr>
            <td class="main" valign="top"><?php echo TEXT_BANNERS_GROUP; ?></td>
            <td class="main"><?php echo go_fetch_pull_down_menu('banners_group', $groups_array, $bInfo->banners_group) . TEXT_BANNERS_NEW_GROUP . '<br>' . go_fetch_inputfeld('new_banners_group', '', '', ((sizeof($groups_array) > 0) ? false : true)); ?></td>
          </tr>
          <tr>
            <td colspan="2"><?php echo go_fetch_dividing_up('tranparentes.gif', '1', '10'); ?></td>
          </tr>
          <tr>
            <td class="main" valign="top"><?php echo TEXT_BANNERS_PICTURE; ?></td>
            <td class="main"><?php echo go_fetch_file_field('banners_picture') . ' ' . TEXT_BANNERS_PICTURE_LOCAL . '<br>' . FOLDER_ABSOLUT_CATALOG_PICTURES . go_fetch_inputfeld('banners_picture_local', (isset($bInfo->banners_picture) ? $bInfo->banners_picture : '')); ?></td>
          </tr>
          <tr>
            <td colspan="2"><?php echo go_fetch_dividing_up('tranparentes.gif', '1', '10'); ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_PICTURE_TARGET; ?></td>
            <td class="main"><?php echo FOLDER_ABSOLUT_CATALOG_PICTURES . go_fetch_inputfeld('banners_picture_target'); ?></td>
          </tr>
          <tr>
            <td colspan="2"><?php echo go_fetch_dividing_up('tranparentes.gif', '1', '10'); ?></td>
          </tr>
          <tr>
            <td valign="top" class="main"><?php echo TEXT_BANNERS_HTML_TEXT; ?></td>
            <td class="main"><?php echo go_fetch_textarea_field('banners_html_text', 'soft', '60', '5', $bInfo->banners_html_text); ?></td>
          </tr>
          <tr>
            <td colspan="2"><?php echo go_fetch_dividing_up('tranparentes.gif', '1', '10'); ?></td>
          </tr>
          <tr>
            <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?><br><small>(dd/mm/yyyy)</small></td>
            <td valign="top" class="main"><script language="javascript">dateScheduled.writeControl(); dateScheduled.dateFormat="dd/MM/yyyy";</script></td>
          </tr>
          <tr>
            <td colspan="2"><?php echo go_fetch_dividing_up('tranparentes.gif', '1', '10'); ?></td>
          </tr>
          <tr>
            <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?><br><small>(dd/mm/yyyy)</small></td>
            <td class="main"><script language="javascript">dateExpires.writeControl(); dateExpires.dateFormat="dd/MM/yyyy";</script><?php echo TEXT_BANNERS_OR_AT . '<br>' . go_fetch_inputfeld('expires_impressions', $bInfo->expires_impressions, 'maxlength="7" size="7"') . ' ' . TEXT_BANNERS_IMPRESSIONS; ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo go_fetch_dividing_up('tranparentes.gif', '1', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <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>
            <td class="main" align="right" valign="top" nowrap><?php echo (($form_action == 'insert') ? go_picture_submit('button_insert.gif', PICTURE_INSERT) : go_picture_submit('button_update.gif', PICTURE_UPDATE)). '&nbsp;&nbsp;<a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . (isset($_GET['bigwareID']) ? 'bigwareID=' . $_GET['bigwareID'] : '')) . '">' . go_picture_button('button_cancel.gif', PICTURE_CANCEL) . '</a>'; ?></td>
          </tr>
        </table></td>
      </form></tr>
<?php
  } else {
?>
      <tr>
        <td><table cellpadding="5" border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table border="0" cellpadding="5" cellspacing="1" style="border-collapse: collapse" width="100%" id="AutoNumber1">
              <tr class="tbUPCountData">
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_BANNERS; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_GROUPS; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_STATISTICS; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_STATUS; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_ACTION; ?>&nbsp;</td>
              </tr>
<?php
    $banners_query_raw = "select banners_id, banners_title, banners_picture, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from " . DB_TBL_BANNERS . " order by banners_title, banners_group";
    $banners_split = new splitPageResults($_GET['page'], MAX_SHOW_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows);
    $banners_query = go_db_query($banners_query_raw);
    while ($banners = go_db_fetch_array($banners_query)) {
      $info_query = go_db_query("select sum(banners_shown) as banners_shown, sum(banners_clicked) as banners_clicked from " . DB_TBL_BANNERS_HISTORY . " where banners_id = '" . (int)$banners['banners_id'] . "'");
      $info = go_db_fetch_array($info_query);
      if ((!isset($_GET['bigwareID']) || (isset($_GET['bigwareID']) && ($_GET['bigwareID'] == $banners['banners_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) {
        $bInfo_array = array_merge($banners, $info);
        $bInfo = new objectInfo($bInfo_array);
      }
      $banners_shown = ($info['banners_shown'] != '') ? $info['banners_shown'] : '0';
      $banners_clicked = ($info['banners_clicked'] != '') ? $info['banners_clicked'] : '0';
      if (isset($bInfo) && is_object($bInfo) && ($banners['banners_id'] == $bInfo->banners_id)) {
        echo '              <tr id="defaultSelected" class="tbCountDataSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_BANNER_STATISTICS, 'page=' . $_GET['page'] . '&bigwareID=' . $bInfo->banners_id) . '\'">' . "\n";
      } else {
        echo '              <tr class="tbCountData" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $banners['banners_id']) . '\'">' . "\n";
      }
?>
                <td class="TbInsideData"><?php echo '<a href="javascript:popupImageWindow(\'' . NAME_OF_FILE_POPUP_PICTURE . '?banner=' . $banners['banners_id'] . '\')">' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_popup.gif', 'View Banner') . '</a>&nbsp;' . $banners['banners_title']; ?></td>
                <td class="TbInsideData" align="right"><?php echo $banners['banners_group']; ?></td>
                <td class="TbInsideData" align="right"><?php echo $banners_shown . ' / ' . $banners_clicked; ?></td>
                <td class="TbInsideData" align="right">
<?php
      if ($banners['status'] == '1') {
        echo go_picture(FOLDER_RELATIV_PICTURES . 'icon_status_green.gif', 'Active', 10, 10) . '&nbsp;&nbsp;<a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $banners['banners_id'] . '&action=setflag&flag=0') . '">' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_status_red_light.gif', 'Set Inactive', 10, 10) . '</a>';
      } else {
        echo '<a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $banners['banners_id'] . '&action=setflag&flag=1') . '">' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_status_green_light.gif', 'Set Active', 10, 10) . '</a>&nbsp;&nbsp;' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_status_red.gif', 'Inactive', 10, 10);
      }
?></td>
                <td class="TbInsideData" align="right"><?php echo '<a href="' . go_href_link(NAME_OF_FILE_BANNER_STATISTICS, 'page=' . $_GET['page'] . '&bigwareID=' . $banners['banners_id']) . '">' . go_picture(FOLDER_RELATIV_ICONS . 'statistics.gif', ICON_STATISTICS) . '</a>&nbsp;'; if (isset($bInfo) && is_object($bInfo) && ($banners['banners_id'] == $bInfo->banners_id)) { echo go_picture(FOLDER_RELATIV_PICTURES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $banners['banners_id']) . '">' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_info.gif', PICTURE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
              </tr>
<?php
    }
?>
              <tr>
                <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="smallText" valign="top"><?php echo $banners_split->display_count($banners_query_numrows, MAX_SHOW_SEARCH_RESULTS, $_GET['page'], TEXT_SHOW_NUMBER_OF_BANNERS); ?></td>
                    <td class="smallText" align="right"><?php echo $banners_split->display_links($banners_query_numrows, MAX_SHOW_SEARCH_RESULTS, MAX_SHOW_PAGE_LINKS, $_GET['page']); ?></td>
                  </tr>
                  <tr>
                    <td align="right" colspan="2"><?php echo '<a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'action=new') . '">' . go_picture_button('button_new_banner.gif', PICTURE_NEW_BANNER) . '</a>'; ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
<?php
  $heading = array();
  $contents = array();
  switch ($action) {
    case 'delete':
      $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>');
      $contents = array('form' => go_fetch_form('banners', NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $bInfo->banners_id . '&action=deleteconfirm'));
      $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
      $contents[] = array('text' => '<br><b>' . $bInfo->banners_title . '</b>');
      if ($bInfo->banners_picture) $contents[] = array('text' => '<br>' . go_fetch_checkbox_field('delete_picture', 'on', true) . ' ' . TEXT_INFO_DELETE_PICTURE);
      $contents[] = array('align' => 'center', 'text' => '<br>' . go_picture_submit('button_delete.gif', PICTURE_DELETE) . '&nbsp;<a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $_GET['bigwareID']) . '">' . go_picture_button('button_cancel.gif', PICTURE_CANCEL) . '</a>');
      break;
    default:
      if (is_object($bInfo)) {
        $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>');
        $contents[] = array('align' => 'center', 'text' => '<a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $bInfo->banners_id . '&action=new') . '">' . go_picture_button('button_change.gif', PICTURE_CHANGE) . '</a> <a href="' . go_href_link(NAME_OF_FILE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bigwareID=' . $bInfo->banners_id . '&action=delete') . '">' . go_picture_button('button_delete.gif', PICTURE_DELETE) . '</a>');
        $contents[] = array('text' => '<br>' . TEXT_BANNERS_DATE_ADDED . ' ' . go_date_short($bInfo->date_added));
        if ( (function_exists('imagecreate')) && ($dir_ok) && ($banner_extension) ) {
          $banner_id = $bInfo->banners_id;
          $days = '3';
          include(FOLDER_RELATIV_INCLUDES . 'graphs/banner_infoclass_bigware_3.php');
          $contents[] = array('align' => 'center', 'text' => '<br>' . go_picture(FOLDER_RELATIV_PICTURES . 'graphs/banner_infoframe-' . $banner_id . '.' . $banner_extension));
        } else {
          include(FOLDER_RELATIV_FUNCTIONS . 'func_bigware_3.php');
          $contents[] = array('align' => 'center', 'text' => '<br>' . go_banner_graph_infoBox($bInfo->banners_id, '3'));
        }
        $contents[] = array('text' => go_picture(FOLDER_RELATIV_PICTURES . 'graph_hbar_blue.gif', 'Blue', '5', '5') . ' ' . TEXT_BANNERS_BANNER_VIEWS . '<br>' . go_picture(FOLDER_RELATIV_PICTURES . 'graph_hbar_red.gif', 'Red', '5', '5') . ' ' . TEXT_BANNERS_BANNER_CLICKS);
        if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_SCHEDULED_AT_DATE, go_date_short($bInfo->date_scheduled)));
        if ($bInfo->expires_date) {
          $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_DATE, go_date_short($bInfo->expires_date)));
        } elseif ($bInfo->expires_impressions) {
          $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions));
        }
        if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_STATUS_CHANGE, go_date_short($bInfo->date_status_change)));
      }
      break;
  }
  if ( (go_not_null($heading)) && (go_not_null($contents)) ) {
    echo '            <td width="25%" valign="top"><br>' . "\n";
    $frame = new frame;
    echo $frame->infoBox($heading, $contents);
    echo '            </td>' . "\n";
  }
?>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); ?>
