|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 require('includes/application_top.php'); 00011 00012 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 00013 if (isset($_GET['flagbanners_on_ssl'])) $_GET['flagbanners_on_ssl'] = (int)$_GET['flagbanners_on_ssl']; 00014 if (isset($_GET['bID'])) $_GET['bID'] = (int)$_GET['bID']; 00015 if (isset($_GET['flag'])) $_GET['flag'] = (int)$_GET['flag']; 00016 if (isset($_GET['page'])) $_GET['page'] = (int)$_GET['page']; 00017 if (isset($_GET['flagbanners_open_new_windows'])) $_GET['flagbanners_open_new_windows'] = (int)$_GET['flagbanners_open_new_windows']; 00018 00019 $banner_extension = zen_banner_image_extension(); 00020 00021 if (zen_not_null($action)) { 00022 switch ($action) { 00023 case 'setflag': 00024 if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) { 00025 zen_set_banner_status($_GET['bID'], $_GET['flag']); 00026 00027 $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success'); 00028 } else { 00029 $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error'); 00030 } 00031 00032 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID'])); 00033 break; 00034 00035 case 'setbanners_on_ssl': 00036 if ( ($_GET['flagbanners_on_ssl'] == '0') || ($_GET['flagbanners_on_ssl'] == '1') ) { 00037 $db->Execute("update " . TABLE_BANNERS . " set banners_on_ssl='" . $_GET['flagbanners_on_ssl'] . "' where banners_id='" . $_GET['bID'] . "'"); 00038 00039 $messageStack->add_session(SUCCESS_BANNER_ON_SSL_UPDATED, 'success'); 00040 } else { 00041 $messageStack->add_session(ERROR_UNKNOWN_BANNER_ON_SSL, 'error'); 00042 } 00043 00044 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID'])); 00045 break; 00046 case 'setbanners_open_new_windows': 00047 if ( ($_GET['flagbanners_open_new_windows'] == '0') || ($_GET['flagbanners_open_new_windows'] == '1') ) { 00048 $db->Execute("update " . TABLE_BANNERS . " set banners_open_new_windows='" . $_GET['flagbanners_open_new_windows'] . "' where banners_id='" . $_GET['bID'] . "'"); 00049 00050 $messageStack->add_session(SUCCESS_BANNER_OPEN_NEW_WINDOW_UPDATED, 'success'); 00051 } else { 00052 $messageStack->add_session(ERROR_UNKNOWN_BANNER_OPEN_NEW_WINDOW, 'error'); 00053 } 00054 00055 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID'])); 00056 break; 00057 case 'insert': 00058 case 'update': 00059 if (isset($_POST['banners_id'])) $banners_id = zen_db_prepare_input($_POST['banners_id']); 00060 $banners_title = zen_db_prepare_input($_POST['banners_title']); 00061 $banners_url = zen_db_prepare_input($_POST['banners_url']); 00062 $new_banners_group = zen_db_prepare_input($_POST['new_banners_group']); 00063 $banners_group = (empty($new_banners_group)) ? zen_db_prepare_input($_POST['banners_group']) : $new_banners_group; 00064 $banners_html_text = zen_db_prepare_input($_POST['banners_html_text']); 00065 $banners_image_local = zen_db_prepare_input($_POST['banners_image_local']); 00066 $banners_image_target = zen_db_prepare_input($_POST['banners_image_target']); 00067 $db_image_location = ''; 00068 $expires_date = zen_db_prepare_input($_POST['expires_date']) == '' ? 'null' : zen_date_raw($_POST['expires_date']); 00069 $expires_impressions = zen_db_prepare_input($_POST['expires_impressions']); 00070 $date_scheduled = zen_db_prepare_input($_POST['date_scheduled']) == '' ? 'null' : zen_date_raw($_POST['date_scheduled']); 00071 $status = zen_db_prepare_input($_POST['status']); 00072 $banners_open_new_windows = zen_db_prepare_input($_POST['banners_open_new_windows']); 00073 $banners_on_ssl = zen_db_prepare_input($_POST['banners_on_ssl']); 00074 $banners_sort_order = zen_db_prepare_input($_POST['banners_sort_order']); 00075 00076 $banner_error = false; 00077 if (empty($banners_title)) { 00078 $messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error'); 00079 $banner_error = true; 00080 } 00081 00082 if (empty($banners_group)) { 00083 $messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error'); 00084 $banner_error = true; 00085 } 00086 00087 if (empty($banners_html_text)) { 00088 if (empty($banners_image_local)) { 00089 $banners_image = new upload('banners_image'); 00090 $banners_image->set_destination(DIR_FS_CATALOG_IMAGES . $banners_image_target); 00091 if ( ($banners_image->parse() == false) || ($banners_image->save() == false) ) { 00092 $messageStack->add(ERROR_BANNER_IMAGE_REQUIRED, 'error'); 00093 $banner_error = true; 00094 } 00095 } 00096 } 00097 00098 if ($banner_error == false) { 00099 $db_image_location = (zen_not_null($banners_image_local)) ? $banners_image_local : $banners_image_target . $banners_image->filename; 00100 $sql_data_array = array('banners_title' => $banners_title, 00101 'banners_url' => $banners_url, 00102 'banners_image' => $db_image_location, 00103 'banners_group' => $banners_group, 00104 'banners_html_text' => $banners_html_text, 00105 'status' => $status, 00106 'banners_open_new_windows' => $banners_open_new_windows, 00107 'banners_on_ssl' => $banners_on_ssl, 00108 'banners_sort_order' => (int)$banners_sort_order); 00109 00110 if ($action == 'insert') { 00111 $insert_sql_data = array('date_added' => 'now()', 00112 'status' => '1'); 00113 00114 $sql_data_array = array_merge($sql_data_array, $insert_sql_data); 00115 00116 zen_db_perform(TABLE_BANNERS, $sql_data_array); 00117 00118 $banners_id = zen_db_insert_id(); 00119 00120 $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success'); 00121 } elseif ($action == 'update') { 00122 zen_db_perform(TABLE_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int)$banners_id . "'"); 00123 00124 $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success'); 00125 } 00126 00127 // NOTE: status will be reset by the /functions/banner.php 00128 // build new update sql for date_scheduled, expires_date and expires_impressions 00129 00130 $sql = "UPDATE " . TABLE_BANNERS . " 00131 SET 00132 date_scheduled = :scheduledDate, 00133 expires_date = DATE_ADD(:expiresDate, INTERVAL '23:59:59' HOUR_SECOND), 00134 expires_impressions = " . ($expires_impressions == 0 ? "null" : ":expiresImpressions") . " 00135 WHERE banners_id = :bannersID"; 00136 if ($expires_impressions > 0) { 00137 $sql = $db->bindVars($sql, ':expiresImpressions', $expires_impressions, 'integer'); 00138 } 00139 if ($date_scheduled != '') { 00140 $sql = $db->bindVars($sql, ':scheduledDate', $date_scheduled, 'date'); 00141 } 00142 if ($expires_date != '') { 00143 $sql = $db->bindVars($sql, ':expiresDate', $expires_date, 'date'); 00144 } 00145 $sql = $db->bindVars($sql, ':bannersID', $banners_id, 'integer'); 00146 $db->Execute($sql); 00147 00148 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'bID=' . $banners_id)); 00149 } else { 00150 $action = 'new'; 00151 } 00152 break; 00153 case 'deleteconfirm': 00154 $banners_id = zen_db_prepare_input($_POST['bID']); 00155 00156 if (isset($_POST['delete_image']) && ($_POST['delete_image'] == 'on')) { 00157 $banner = $db->Execute("select banners_image 00158 from " . TABLE_BANNERS . " 00159 where banners_id = '" . (int)$banners_id . "'"); 00160 00161 if (is_file(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image'])) { 00162 if (is_writeable(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image'])) { 00163 unlink(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image']); 00164 } else { 00165 $messageStack->add_session(ERROR_IMAGE_IS_NOT_WRITEABLE, 'error'); 00166 } 00167 } else { 00168 $messageStack->add_session(ERROR_IMAGE_DOES_NOT_EXIST, 'error'); 00169 } 00170 } 00171 00172 $db->Execute("delete from " . TABLE_BANNERS . " 00173 where banners_id = '" . (int)$banners_id . "'"); 00174 $db->Execute("delete from " . TABLE_BANNERS_HISTORY . " 00175 where banners_id = '" . (int)$banners_id . "'"); 00176 00177 if (function_exists('imagecreate') && zen_not_null($banner_extension)) { 00178 if (is_file(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) { 00179 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) { 00180 unlink(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension); 00181 } 00182 } 00183 00184 if (is_file(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) { 00185 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) { 00186 unlink(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension); 00187 } 00188 } 00189 00190 if (is_file(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) { 00191 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) { 00192 unlink(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension); 00193 } 00194 } 00195 00196 if (is_file(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) { 00197 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) { 00198 unlink(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension); 00199 } 00200 } 00201 } 00202 00203 $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success'); 00204 00205 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'])); 00206 break; 00207 } 00208 } 00209 00210 // check if the graphs directory exists 00211 $dir_ok = false; 00212 if (function_exists('imagecreate') && zen_not_null($banner_extension)) { 00213 if (is_dir(DIR_WS_IMAGES . 'graphs')) { 00214 if (is_writeable(DIR_WS_IMAGES . 'graphs')) { 00215 $dir_ok = true; 00216 } else { 00217 $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error'); 00218 } 00219 } else { 00220 $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error'); 00221 } 00222 } 00223 ?> 00224 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00225 <html <?php echo HTML_PARAMS; ?>> 00226 <head> 00227 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00228 <title><?php echo TITLE; ?></title> 00229 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00230 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00231 <script language="javascript" src="includes/menu.js"></script> 00232 <script language="javascript" src="includes/general.js"></script> 00233 <script language="javascript"><!-- 00234 function popupImageWindow(url) { 00235 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') 00236 } 00237 //--></script> 00238 <script type="text/javascript"> 00239 <!-- 00240 function init() 00241 { 00242 cssjsmenu('navbar'); 00243 if (document.getElementById) 00244 { 00245 var kill = document.getElementById('hoverJS'); 00246 kill.disabled = true; 00247 } 00248 } 00249 // --> 00250 </script> 00251 </head> 00252 <body onload="init()"> 00253 <div id="spiffycalendar" class="text"></div> 00254 <!-- header //--> 00255 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 00256 <!-- header_eof //--> 00257 00258 <!-- body //--> 00259 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00260 <tr> 00261 <!-- body_text //--> 00262 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00263 <tr> 00264 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00265 <tr> 00266 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00267 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 00268 </tr> 00269 </table></td> 00270 </tr> 00271 <?php if ($action=='') { ?> 00272 <tr> 00273 <td><table border="0" cellspacing="0" cellpadding="0"> 00274 <tr> 00275 <td class="smallText" align="center" width="100"><?php echo TEXT_LEGEND; ?></td> 00276 <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) . ' ' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON); ?></td> 00277 <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) . ' ' . zen_image(DIR_WS_IMAGES . 'icon_blue_off.gif', IMAGE_ICON_BANNER_ON_SSL_OFF); ?></td> 00278 <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) . ' ' . zen_image(DIR_WS_IMAGES . 'icon_orange_off.gif', IMAGE_ICON_BANNER_OPEN_NEW_WINDOWS_OFF); ?></td> 00279 </tr> 00280 </table></td> 00281 </tr> 00282 <?php } // legend ?> 00283 <?php 00284 if ($action == 'new') { 00285 $form_action = 'insert'; 00286 00287 $parameters = array('expires_date' => '', 00288 'date_scheduled' => '', 00289 'banners_title' => '', 00290 'banners_url' => '', 00291 'banners_group' => '', 00292 'banners_image' => '', 00293 'banners_html_text' => '', 00294 'expires_impressions' => '', 00295 'banners_open_new_windows' => '', 00296 'banners_on_ssl' => ''); 00297 00298 $bInfo = new objectInfo($parameters); 00299 00300 if (isset($_GET['bID'])) { 00301 $form_action = 'update'; 00302 00303 $bID = zen_db_prepare_input($_GET['bID']); 00304 00305 $banner = $db->Execute("select banners_title, banners_url, banners_image, banners_group, 00306 banners_html_text, status, 00307 date_format(date_scheduled, '%Y/%m/%d') as date_scheduled, 00308 date_format(expires_date, '%Y/%m/%d') as expires_date, 00309 expires_impressions, date_status_change, banners_open_new_windows, banners_on_ssl, banners_sort_order 00310 from " . TABLE_BANNERS . " 00311 where banners_id = '" . (int)$bID . "'"); 00312 00313 $bInfo->objectInfo($banner->fields); 00314 } elseif (zen_not_null($_POST)) { 00315 $bInfo->objectInfo($_POST); 00316 } 00317 00318 if (!isset($bInfo->status)) $bInfo->status = '1'; 00319 switch ($bInfo->status) { 00320 case '0': $is_status = false; $not_status = true; break; 00321 case '1': $is_status = true; $not_status = false; break; 00322 default: $is_status = true; $not_status = false; break; 00323 } 00324 if (!isset($bInfo->banners_open_new_windows)) $bInfo->banners_open_new_windows = '1'; 00325 switch ($bInfo->banners_open_new_windows) { 00326 case '0': $is_banners_open_new_windows = false; $not_banners_open_new_windows = true; break; 00327 case '1': $is_banners_open_new_windows = true; $not_banners_open_new_windows = false; break; 00328 default: $is_banners_open_new_windows = true; $not_banners_open_new_windows = false; break; 00329 } 00330 if (!isset($bInfo->banners_on_ssl)) $bInfo->banners_on_ssl = '1'; 00331 switch ($bInfo->banners_on_ssl) { 00332 case '0': $is_banners_on_ssl = false; $not_banners_on_ssl = true; break; 00333 case '1': $is_banners_on_ssl = true; $not_banners_on_ssl = false; break; 00334 default: $is_banners_on_ssl = true; $not_banners_on_ssl = false; break; 00335 } 00336 00337 $groups_array = array(); 00338 $groups = $db->Execute("select distinct banners_group 00339 from " . TABLE_BANNERS . " 00340 order by banners_group"); 00341 while (!$groups->EOF) { 00342 $groups_array[] = array('id' => $groups->fields['banners_group'], 'text' => $groups->fields['banners_group']); 00343 $groups->MoveNext(); 00344 } 00345 ?> 00346 <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css"> 00347 <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script> 00348 <script language="javascript"> 00349 var dateExpires = new ctlSpiffyCalendarBox("dateExpires", "new_banner", "expires_date","btnDate1","<?php echo zen_date_short($bInfo->expires_date); ?>",scBTNMODE_CUSTOMBLUE); 00350 var dateScheduled = new ctlSpiffyCalendarBox("dateScheduled", "new_banner", "date_scheduled","btnDate2","<?php echo zen_date_short($bInfo->date_scheduled); ?>",scBTNMODE_CUSTOMBLUE); 00351 </script> 00352 <tr> 00353 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00354 </tr> 00355 <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); ?> 00356 <td><table border="0" cellspacing="0" cellpadding="2"> 00357 <tr> 00358 <td class="main"><?php echo TEXT_BANNERS_STATUS; ?></td> 00359 <td class="main"><?php echo zen_draw_radio_field('status', '1', $is_status) . ' ' . TEXT_BANNERS_ACTIVE . ' ' . zen_draw_radio_field('status', '0', $not_status) . ' ' . TEXT_BANNERS_NOT_ACTIVE . '<br />' . TEXT_INFO_BANNER_STATUS; ?></td> 00360 </tr> 00361 <tr> 00362 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00363 </tr> 00364 <tr> 00365 <td class="main"><?php echo TEXT_BANNERS_OPEN_NEW_WINDOWS; ?></td> 00366 <td class="main"><?php echo zen_draw_radio_field('banners_open_new_windows', '1', $is_banners_open_new_windows) . ' ' . TEXT_YES . ' ' . zen_draw_radio_field('banners_open_new_windows', '0', $not_banners_open_new_windows) . ' ' . TEXT_NO . '<br />' . TEXT_INFO_BANNER_OPEN_NEW_WINDOWS; ?></td> 00367 </tr> 00368 <tr> 00369 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00370 </tr> 00371 <tr> 00372 <td class="main"><?php echo TEXT_BANNERS_ON_SSL; ?></td> 00373 <td class="main"><?php echo zen_draw_radio_field('banners_on_ssl', '1', $is_banners_on_ssl) . ' ' . TEXT_YES . ' ' . zen_draw_radio_field('banners_on_ssl', '0', $not_banners_on_ssl) . ' ' . TEXT_NO . '<br />' . TEXT_INFO_BANNER_ON_SSL; ?></td> 00374 </tr> 00375 <tr> 00376 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00377 </tr> 00378 <tr> 00379 <td class="main"><?php echo TEXT_BANNERS_TITLE; ?></td> 00380 <td class="main"><?php echo zen_draw_input_field('banners_title', htmlspecialchars($bInfo->banners_title, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_BANNERS, 'banners_title'), true); ?></td> 00381 </tr> 00382 <tr> 00383 <td class="main"><?php echo TEXT_BANNERS_URL; ?></td> 00384 <td class="main"><?php echo zen_draw_input_field('banners_url', $bInfo->banners_url, zen_set_field_length(TABLE_BANNERS, 'banners_url')); ?></td> 00385 </tr> 00386 <tr> 00387 <td class="main" valign="top"><?php echo TEXT_BANNERS_GROUP; ?></td> 00388 <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> 00389 </tr> 00390 <tr> 00391 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00392 </tr> 00393 <tr> 00394 <td class="main" valign="top"><?php echo TEXT_BANNERS_IMAGE; ?></td> 00395 <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> 00396 </tr> 00397 <tr> 00398 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00399 </tr> 00400 <tr> 00401 <td class="main"><?php echo TEXT_BANNERS_IMAGE_TARGET; ?></td> 00402 <td class="main"><?php echo DIR_FS_CATALOG_IMAGES . zen_draw_input_field('banners_image_target'); ?></td> 00403 </tr> 00404 <tr> 00405 <td class="main" colspan="2"><?php echo TEXT_BANNER_IMAGE_TARGET_INFO; ?></td> 00406 </tr> 00407 <tr> 00408 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00409 </tr> 00410 <tr> 00411 <td valign="top" class="main"><?php echo TEXT_BANNERS_HTML_TEXT; ?></td> 00412 <td class="main"><?php echo TEXT_BANNERS_HTML_TEXT_INFO . '<br />' . zen_draw_textarea_field('banners_html_text', 'soft', '60', '5', htmlspecialchars($bInfo->banners_html_text, ENT_COMPAT, CHARSET, TRUE)); ?></td> 00413 </tr> 00414 <tr> 00415 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00416 </tr> 00417 <tr> 00418 <td class="main"><?php echo TEXT_BANNERS_ALL_SORT_ORDER; ?></td> 00419 <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> 00420 </tr> 00421 <tr> 00422 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00423 </tr> 00424 <tr> 00425 <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?></td> 00426 <td valign="top" class="main"><script language="javascript">dateScheduled.writeControl();dateScheduled.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script></td> 00427 </tr> 00428 <tr> 00429 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00430 </tr> 00431 <tr> 00432 <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?></td> 00433 <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> 00434 </tr> 00435 </table></td> 00436 </tr> 00437 <tr> 00438 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00439 </tr> 00440 <tr> 00441 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00442 <tr> 00443 <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> 00444 <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)). ' <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> 00445 </tr> 00446 </table></td> 00447 </form></tr> 00448 <?php 00449 } else { 00450 ?> 00451 <tr> 00452 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00453 <tr> 00454 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00455 <tr class="dataTableHeadingRow"> 00456 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_BANNERS; ?></td> 00457 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_GROUPS; ?></td> 00458 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATISTICS; ?></td> 00459 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td> 00460 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_BANNER_OPEN_NEW_WINDOWS; ?></td> 00461 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_BANNER_ON_SSL; ?></td> 00462 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_BANNER_SORT_ORDER; ?></td> 00463 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 00464 </tr> 00465 <?php 00466 // Split Page 00467 // reset page when page is unknown 00468 if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['bID'] != '') { 00469 $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"; 00470 $check_page = $db->Execute($banners_query_raw); 00471 $check_count=1; 00472 if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) { 00473 while (!$check_page->EOF) { 00474 if ($check_page->fields['banners_id'] == $_GET['bID']) { 00475 break; 00476 } 00477 $check_count++; 00478 $check_page->MoveNext(); 00479 } 00480 $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0); 00481 } else { 00482 $_GET['page'] = 1; 00483 } 00484 } 00485 00486 $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"; 00487 $banners_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows); 00488 $banners = $db->Execute($banners_query_raw); 00489 while (!$banners->EOF) { 00490 $info = $db->Execute("select sum(banners_shown) as banners_shown, 00491 sum(banners_clicked) as banners_clicked 00492 from " . TABLE_BANNERS_HISTORY . " 00493 where banners_id = '" . (int)$banners->fields['banners_id'] . "'"); 00494 00495 if ((!isset($_GET['bID']) || (isset($_GET['bID']) && ($_GET['bID'] == $banners->fields['banners_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) { 00496 $bInfo_array = array_merge($banners->fields, $info->fields); 00497 $bInfo = new objectInfo($bInfo_array); 00498 } 00499 00500 $banners_shown = ($info->fields['banners_shown'] != '') ? $info->fields['banners_shown'] : '0'; 00501 $banners_clicked = ($info->fields['banners_clicked'] != '') ? $info->fields['banners_clicked'] : '0'; 00502 00503 if (isset($bInfo) && is_object($bInfo) && ($banners->fields['banners_id'] == $bInfo->banners_id)) { 00504 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"; 00505 } else { 00506 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"; 00507 } 00508 ?> 00509 <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> ' . $banners->fields['banners_title']; ?></td> 00510 <td class="dataTableContent" align="right"><?php echo $banners->fields['banners_group']; ?></td> 00511 <td class="dataTableContent" align="right"><?php echo $banners_shown . ' / ' . $banners_clicked; ?></td> 00512 <td class="dataTableContent" align="center"> 00513 <?php 00514 if ($banners->fields['status'] == '1') { 00515 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>'; 00516 } else { 00517 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>'; 00518 } 00519 ?> 00520 </td> 00521 <td class="dataTableContent" align="center"> 00522 <?php 00523 if ($banners->fields['banners_open_new_windows'] == '1') { 00524 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>'; 00525 } else { 00526 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>'; 00527 } 00528 ?> 00529 </td> 00530 <td class="dataTableContent" align="center"> 00531 <?php 00532 if ($banners->fields['banners_on_ssl'] == '1') { 00533 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>'; 00534 } else { 00535 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>'; 00536 } 00537 ?> 00538 </td> 00539 <td class="dataTableContent" align="right"><?php echo $banners->fields['banners_sort_order']; ?></td> 00540 00541 <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> '; 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>'; } ?> </td> 00542 </tr> 00543 <?php 00544 $banners->MoveNext(); 00545 } 00546 ?> 00547 <tr> 00548 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00549 <tr> 00550 <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> 00551 <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> 00552 </tr> 00553 <tr> 00554 <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> 00555 </tr> 00556 </table></td> 00557 </tr> 00558 </table></td> 00559 <?php 00560 $heading = array(); 00561 $contents = array(); 00562 switch ($action) { 00563 case 'delete': 00564 $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>'); 00565 00566 $contents = array('form' => zen_draw_form('banners', FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('bID', $bInfo->banners_id)); 00567 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); 00568 $contents[] = array('text' => '<br><b>' . $bInfo->banners_title . '</b>'); 00569 if ($bInfo->banners_image) $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_image', 'on', true) . ' ' . TEXT_INFO_DELETE_IMAGE); 00570 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00571 break; 00572 default: 00573 if (is_object($bInfo)) { 00574 $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>'); 00575 00576 $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>'); 00577 $contents[] = array('text' => '<br>' . TEXT_BANNERS_DATE_ADDED . ' ' . zen_date_short($bInfo->date_added)); 00578 $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>' ); 00579 00580 if ( (function_exists('imagecreate')) && ($dir_ok) && ($banner_extension) ) { 00581 $banner_id = $bInfo->banners_id; 00582 $days = '3'; 00583 include(DIR_WS_INCLUDES . 'graphs/banner_infobox.php'); 00584 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banner_id . '.' . $banner_extension)); 00585 } else { 00586 include(DIR_WS_FUNCTIONS . 'html_graphs.php'); 00587 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_banner_graph_infoBox($bInfo->banners_id, '3')); 00588 } 00589 00590 $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); 00591 00592 if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_SCHEDULED_AT_DATE, zen_date_short($bInfo->date_scheduled))); 00593 00594 if ($bInfo->expires_date) { 00595 $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_DATE, zen_date_short($bInfo->expires_date))); 00596 } elseif ($bInfo->expires_impressions) { 00597 $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions)); 00598 } 00599 00600 if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_STATUS_CHANGE, zen_date_short($bInfo->date_status_change))); 00601 } 00602 break; 00603 } 00604 00605 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 00606 echo ' <td width="25%" valign="top">' . "\n"; 00607 00608 $box = new box; 00609 echo $box->infoBox($heading, $contents); 00610 00611 echo ' </td>' . "\n"; 00612 } 00613 ?> 00614 </tr> 00615 </table></td> 00616 </tr> 00617 <?php 00618 } 00619 ?> 00620 </table></td> 00621 <!-- body_text_eof //--> 00622 </tr> 00623 </table> 00624 <!-- body_eof //--> 00625 00626 <!-- footer //--> 00627 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 00628 <!-- footer_eof //--> 00629 <br> 00630 </body> 00631 </html> 00632 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>