[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // |zen-cart Open Source E-commerce | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2006 The zen-cart developers | 7 // | | 8 // | http://www.zen-cart.com/index.php | 9 // | | 10 // | Portions Copyright (c) 2003 osCommerce | 11 // +----------------------------------------------------------------------+ 12 // | This source file is subject to version 2.0 of the GPL license, | 13 // | that is bundled with this package in the file LICENSE, and is | 14 // | available through the world-wide-web at the following url: | 15 // | http://www.zen-cart.com/license/2_0.txt. | 16 // | If you did not receive a copy of the zen-cart license and are unable | 17 // | to obtain it through the world-wide-web, please send a note to | 18 // | license@zen-cart.com so we can mail you a copy immediately. | 19 // +----------------------------------------------------------------------+ 20 // $Id: banner_manager.php 4675 2006-10-03 03:31:35Z ajeh $ 21 // 22 23 require ('includes/application_top.php'); 24 25 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 26 27 $banner_extension = zen_banner_image_extension(); 28 29 if (zen_not_null($action)) { 30 switch ($action) { 31 case 'setflag': 32 if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) { 33 zen_set_banner_status($_GET['bID'], $_GET['flag']); 34 35 $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success'); 36 } else { 37 $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error'); 38 } 39 40 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID'])); 41 break; 42 43 case 'setbanners_on_ssl': 44 if ( ($_GET['flagbanners_on_ssl'] == '0') || ($_GET['flagbanners_on_ssl'] == '1') ) { 45 $db->Execute("update " . TABLE_BANNERS . " set banners_on_ssl='" . $_GET['flagbanners_on_ssl'] . "' where banners_id='" . $_GET['bID'] . "'"); 46 47 $messageStack->add_session(SUCCESS_BANNER_ON_SSL_UPDATED, 'success'); 48 } else { 49 $messageStack->add_session(ERROR_UNKNOWN_BANNER_ON_SSL, 'error'); 50 } 51 52 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID'])); 53 break; 54 case 'setbanners_open_new_windows': 55 if ( ($_GET['flagbanners_open_new_windows'] == '0') || ($_GET['flagbanners_open_new_windows'] == '1') ) { 56 $db->Execute("update " . TABLE_BANNERS . " set banners_open_new_windows='" . $_GET['flagbanners_open_new_windows'] . "' where banners_id='" . $_GET['bID'] . "'"); 57 58 $messageStack->add_session(SUCCESS_BANNER_OPEN_NEW_WINDOW_UPDATED, 'success'); 59 } else { 60 $messageStack->add_session(ERROR_UNKNOWN_BANNER_OPEN_NEW_WINDOW, 'error'); 61 } 62 63 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID'])); 64 break; 65 case 'insert': 66 case 'update': 67 if (isset($_POST['banners_id'])) $banners_id = zen_db_prepare_input($_POST['banners_id']); 68 $banners_title = zen_db_prepare_input($_POST['banners_title']); 69 $banners_url = zen_db_prepare_input($_POST['banners_url']); 70 $new_banners_group = zen_db_prepare_input($_POST['new_banners_group']); 71 $banners_group = (empty($new_banners_group)) ? zen_db_prepare_input($_POST['banners_group']) : $new_banners_group; 72 $banners_html_text = zen_db_prepare_input($_POST['banners_html_text']); 73 $banners_image_local = zen_db_prepare_input($_POST['banners_image_local']); 74 $banners_image_target = zen_db_prepare_input($_POST['banners_image_target']); 75 $db_image_location = ''; 76 $expires_date = zen_db_prepare_input($_POST['expires_date']); 77 $expires_impressions = zen_db_prepare_input($_POST['expires_impressions']); 78 $date_scheduled = zen_db_prepare_input($_POST['date_scheduled']); 79 $status = zen_db_prepare_input($_POST['status']); 80 $banners_open_new_windows = zen_db_prepare_input($_POST['banners_open_new_windows']); 81 $banners_on_ssl = zen_db_prepare_input($_POST['banners_on_ssl']); 82 $banners_sort_order = zen_db_prepare_input($_POST['banners_sort_order']); 83 84 $banner_error = false; 85 if (empty($banners_title)) { 86 $messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error'); 87 $banner_error = true; 88 } 89 90 if (empty($banners_group)) { 91 $messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error'); 92 $banner_error = true; 93 } 94 95 if (empty($banners_html_text)) { 96 if (empty($banners_image_local)) { 97 $banners_image = new upload('banners_image'); 98 $banners_image->set_destination(DIR_FS_CATALOG_IMAGES . $banners_image_target); 99 if ( ($banners_image->parse() == false) || ($banners_image->save() == false) ) { 100 $messageStack->add(ERROR_BANNER_IMAGE_REQUIRED, 'error'); 101 $banner_error = true; 102 } 103 } 104 } 105 106 if ($banner_error == false) { 107 $db_image_location = (zen_not_null($banners_image_local)) ? $banners_image_local : $banners_image_target . $banners_image->filename; 108 $sql_data_array = array('banners_title' => $banners_title, 109 'banners_url' => $banners_url, 110 'banners_image' => $db_image_location, 111 'banners_group' => $banners_group, 112 'banners_html_text' => $banners_html_text, 113 'status' => $status, 114 'banners_open_new_windows' => $banners_open_new_windows, 115 'banners_on_ssl' => $banners_on_ssl, 116 'banners_sort_order' => (int)$banners_sort_order); 117 118 if ($action == 'insert') { 119 $insert_sql_data = array('date_added' => 'now()', 120 'status' => '1'); 121 122 $sql_data_array = array_merge($sql_data_array, $insert_sql_data); 123 124 zen_db_perform(TABLE_BANNERS, $sql_data_array); 125 126 $banners_id = zen_db_insert_id(); 127 128 $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success'); 129 } elseif ($action == 'update') { 130 zen_db_perform(TABLE_BANNERS, $sql_data_array, 'update', "banners_id = '" . (int)$banners_id . "'"); 131 132 $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success'); 133 } 134 135 // NOTE: status will be reset by the /functions/banner.php 136 if (zen_not_null($expires_date)) { 137 list($day, $month, $year) = explode('/', $expires_date); 138 139 $expires_date = $year . 140 ((strlen($month) == 1) ? '0' . $month : $month) . 141 ((strlen($day) == 1) ? '0' . $day : $day); 142 143 $db->Execute("update " . TABLE_BANNERS . " 144 set expires_date = '" . zen_db_input($expires_date) . "', 145 expires_impressions = null 146 where banners_id = '" . (int)$banners_id . "'"); 147 148 } elseif (zen_not_null($expires_impressions)) { 149 $db->Execute("update " . TABLE_BANNERS . " 150 set expires_impressions = '" . zen_db_input($expires_impressions) . "', 151 expires_date = null 152 where banners_id = '" . (int)$banners_id . "'"); 153 } 154 155 156 if (zen_not_null($date_scheduled)) { 157 list($day, $month, $year) = explode('/', $date_scheduled); 158 159 $date_scheduled = $year . 160 ((strlen($month) == 1) ? '0' . $month : $month) . 161 ((strlen($day) == 1) ? '0' . $day : $day); 162 163 $db->Execute("update " . TABLE_BANNERS . " 164 set date_scheduled = '" . zen_db_input($date_scheduled) . "' 165 where banners_id = '" . (int)$banners_id . "'"); 166 } else { 167 $db->Execute("update " . TABLE_BANNERS . " 168 set date_scheduled = null 169 where banners_id = '" . (int)$banners_id . "'"); 170 } 171 172 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'bID=' . $banners_id)); 173 } else { 174 $action = 'new'; 175 } 176 break; 177 case 'deleteconfirm': 178 $banners_id = zen_db_prepare_input($_GET['bID']); 179 180 if (isset($_POST['delete_image']) && ($_POST['delete_image'] == 'on')) { 181 $banner = $db->Execute("select banners_image 182 from " . TABLE_BANNERS . " 183 where banners_id = '" . (int)$banners_id . "'"); 184 185 if (is_file(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image'])) { 186 if (is_writeable(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image'])) { 187 unlink(DIR_FS_CATALOG_IMAGES . $banner->fields['banners_image']); 188 } else { 189 $messageStack->add_session(ERROR_IMAGE_IS_NOT_WRITEABLE, 'error'); 190 } 191 } else { 192 $messageStack->add_session(ERROR_IMAGE_DOES_NOT_EXIST, 'error'); 193 } 194 } 195 196 $db->Execute("delete from " . TABLE_BANNERS . " 197 where banners_id = '" . (int)$banners_id . "'"); 198 $db->Execute("delete from " . TABLE_BANNERS_HISTORY . " 199 where banners_id = '" . (int)$banners_id . "'"); 200 201 if (function_exists('imagecreate') && zen_not_null($banner_extension)) { 202 if (is_file(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) { 203 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension)) { 204 unlink(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banners_id . '.' . $banner_extension); 205 } 206 } 207 208 if (is_file(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) { 209 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension)) { 210 unlink(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banners_id . '.' . $banner_extension); 211 } 212 } 213 214 if (is_file(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) { 215 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension)) { 216 unlink(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banners_id . '.' . $banner_extension); 217 } 218 } 219 220 if (is_file(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) { 221 if (is_writeable(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension)) { 222 unlink(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banners_id . '.' . $banner_extension); 223 } 224 } 225 } 226 227 $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success'); 228 229 zen_redirect(zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'])); 230 break; 231 } 232 } 233 234 // check if the graphs directory exists 235 $dir_ok = false; 236 if (function_exists('imagecreate') && zen_not_null($banner_extension)) { 237 if (is_dir(DIR_WS_IMAGES . 'graphs')) { 238 if (is_writeable(DIR_WS_IMAGES . 'graphs')) { 239 $dir_ok = true; 240 } else { 241 $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error'); 242 } 243 } else { 244 $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error'); 245 } 246 } 247 ?> 248 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 249 <html <?php echo HTML_PARAMS; ?>> 250 <head> 251 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 252 <title><?php echo TITLE; ?></title> 253 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 254 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 255 <script language="javascript" src="includes/menu.js"></script> 256 <script language="javascript" src="includes/general.js"></script> 257 <script language="javascript"><!-- 258 function popupImageWindow(url) { 259 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') 260 } 261 //--></script> 262 <script type="text/javascript"> 263 <!-- 264 function init() 265 { 266 cssjsmenu('navbar'); 267 if (document.getElementById) 268 { 269 var kill = document.getElementById('hoverJS'); 270 kill.disabled = true; 271 } 272 } 273 // --> 274 </script> 275 </head> 276 <body onload="init()"> 277 <div id="spiffycalendar" class="text"></div> 278 <!-- header //--> 279 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 280 <!-- header_eof //--> 281 282 <!-- body //--> 283 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 284 <tr> 285 <!-- body_text //--> 286 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 287 <tr> 288 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 289 <tr> 290 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 291 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 292 </tr> 293 </table></td> 294 </tr> 295 <?php if ($action=='') { ?> 296 <tr> 297 <td><table border="0" cellspacing="0" cellpadding="0"> 298 <tr> 299 <td class="smallText" align="center" width="100"><?php echo TEXT_LEGEND; ?></td> 300 <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> 301 <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> 302 <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> 303 </tr> 304 </table></td> 305 </tr> 306 <?php } // legend ?> 307 <?php 308 if ($action == 'new') { 309 $form_action = 'insert'; 310 311 $parameters = array('expires_date' => '', 312 'date_scheduled' => '', 313 'banners_title' => '', 314 'banners_url' => '', 315 'banners_group' => '', 316 'banners_image' => '', 317 'banners_html_text' => '', 318 'expires_impressions' => '', 319 'banners_open_new_windows' => '', 320 'banners_on_ssl' => ''); 321 322 $bInfo = new objectInfo($parameters); 323 324 if (isset($_GET['bID'])) { 325 $form_action = 'update'; 326 327 $bID = zen_db_prepare_input($_GET['bID']); 328 329 $banner = $db->Execute("select banners_title, banners_url, banners_image, banners_group, 330 banners_html_text, status, 331 date_format(date_scheduled, '%d/%m/%Y') as date_scheduled, 332 date_format(expires_date, '%d/%m/%Y') as expires_date, 333 expires_impressions, date_status_change, banners_open_new_windows, banners_on_ssl, banners_sort_order 334 from " . TABLE_BANNERS . " 335 where banners_id = '" . (int)$bID . "'"); 336 337 $bInfo->objectInfo($banner->fields); 338 } elseif (zen_not_null($_POST)) { 339 $bInfo->objectInfo($_POST); 340 } 341 342 if (!isset($bInfo->status)) $bInfo->status = '1'; 343 switch ($bInfo->status) { 344 case '0': $is_status = false; $not_status = true; break; 345 case '1': $is_status = true; $not_status = false; break; 346 default: $is_status = true; $not_status = false; break; 347 } 348 if (!isset($bInfo->banners_open_new_windows)) $bInfo->banners_open_new_windows = '1'; 349 switch ($bInfo->banners_open_new_windows) { 350 case '0': $is_banners_open_new_windows = false; $not_banners_open_new_windows = true; break; 351 case '1': $is_banners_open_new_windows = true; $not_banners_open_new_windows = false; break; 352 default: $is_banners_open_new_windows = true; $not_banners_open_new_windows = false; break; 353 } 354 if (!isset($bInfo->banners_on_ssl)) $bInfo->banners_on_ssl = '1'; 355 switch ($bInfo->banners_on_ssl) { 356 case '0': $is_banners_on_ssl = false; $not_banners_on_ssl = true; break; 357 case '1': $is_banners_on_ssl = true; $not_banners_on_ssl = false; break; 358 default: $is_banners_on_ssl = true; $not_banners_on_ssl = false; break; 359 } 360 361 $groups_array = array(); 362 $groups = $db->Execute("select distinct banners_group 363 from " . TABLE_BANNERS . " 364 order by banners_group"); 365 while (!$groups->EOF) { 366 $groups_array[] = array('id' => $groups->fields['banners_group'], 'text' => $groups->fields['banners_group']); 367 $groups->MoveNext(); 368 } 369 ?> 370 <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css"> 371 <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script> 372 <script language="javascript"> 373 var dateExpires = new ctlSpiffyCalendarBox("dateExpires", "new_banner", "expires_date","btnDate1","<?php echo $bInfo->expires_date; ?>",scBTNMODE_CUSTOMBLUE); 374 var dateScheduled = new ctlSpiffyCalendarBox("dateScheduled", "new_banner", "date_scheduled","btnDate2","<?php echo $bInfo->date_scheduled; ?>",scBTNMODE_CUSTOMBLUE); 375 </script> 376 <tr> 377 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 378 </tr> 379 <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); ?> 380 <td><table border="0" cellspacing="0" cellpadding="2"> 381 <tr> 382 <td class="main"><?php echo TEXT_BANNERS_STATUS; ?></td> 383 <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> 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"><?php echo TEXT_BANNERS_OPEN_NEW_WINDOWS; ?></td> 390 <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> 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_ON_SSL; ?></td> 397 <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> 398 </tr> 399 <tr> 400 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 401 </tr> 402 <tr> 403 <td class="main"><?php echo TEXT_BANNERS_TITLE; ?></td> 404 <td class="main"><?php echo zen_draw_input_field('banners_title', $bInfo->banners_title, zen_set_field_length(TABLE_BANNERS, 'banners_title'), true); ?></td> 405 </tr> 406 <tr> 407 <td class="main"><?php echo TEXT_BANNERS_URL; ?></td> 408 <td class="main"><?php echo zen_draw_input_field('banners_url', $bInfo->banners_url, zen_set_field_length(TABLE_BANNERS, 'banners_url')); ?></td> 409 </tr> 410 <tr> 411 <td class="main" valign="top"><?php echo TEXT_BANNERS_GROUP; ?></td> 412 <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> 413 </tr> 414 <tr> 415 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 416 </tr> 417 <tr> 418 <td class="main" valign="top"><?php echo TEXT_BANNERS_IMAGE; ?></td> 419 <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> 420 </tr> 421 <tr> 422 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 423 </tr> 424 <tr> 425 <td class="main"><?php echo TEXT_BANNERS_IMAGE_TARGET; ?></td> 426 <td class="main"><?php echo DIR_FS_CATALOG_IMAGES . zen_draw_input_field('banners_image_target'); ?></td> 427 </tr> 428 <tr> 429 <td class="main" colspan="2"><?php echo TEXT_BANNER_IMAGE_TARGET_INFO; ?></td> 430 </tr> 431 <tr> 432 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 433 </tr> 434 <tr> 435 <td valign="top" class="main"><?php echo TEXT_BANNERS_HTML_TEXT; ?></td> 436 <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> 437 </tr> 438 <tr> 439 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 440 </tr> 441 <tr> 442 <td class="main"><?php echo TEXT_BANNERS_ALL_SORT_ORDER; ?></td> 443 <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> 444 </tr> 445 <tr> 446 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 447 </tr> 448 <tr> 449 <td class="main"><?php echo TEXT_BANNERS_SCHEDULED_AT; ?><br><small>(dd/mm/yyyy)</small></td> 450 <td valign="top" class="main"><script language="javascript">dateScheduled.writeControl(); dateScheduled.dateFormat="dd/MM/yyyy";</script></td> 451 </tr> 452 <tr> 453 <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 454 </tr> 455 <tr> 456 <td valign="top" class="main"><?php echo TEXT_BANNERS_EXPIRES_ON; ?><br><small>(dd/mm/yyyy)</small></td> 457 <td class="main"><script language="javascript">dateExpires.writeControl(); dateExpires.dateFormat="dd/MM/yyyy";</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> 458 </tr> 459 </table></td> 460 </tr> 461 <tr> 462 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 463 </tr> 464 <tr> 465 <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> 466 <tr> 467 <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> 468 <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> 469 </tr> 470 </table></td> 471 </form></tr> 472 <?php 473 } else { 474 ?> 475 <tr> 476 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 477 <tr> 478 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 479 <tr class="dataTableHeadingRow"> 480 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_BANNERS; ?></td> 481 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_GROUPS; ?></td> 482 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATISTICS; ?></td> 483 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td> 484 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_BANNER_OPEN_NEW_WINDOWS; ?></td> 485 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_BANNER_ON_SSL; ?></td> 486 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_BANNER_SORT_ORDER; ?></td> 487 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 488 </tr> 489 <?php 490 // Split Page 491 // reset page when page is unknown 492 if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['bID'] != '') { 493 $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"; 494 $check_page = $db->Execute($banners_query_raw); 495 $check_count=1; 496 if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) { 497 while (!$check_page->EOF) { 498 if ($check_page->fields['banners_id'] == $_GET['bID']) { 499 break; 500 } 501 $check_count++; 502 $check_page->MoveNext(); 503 } 504 $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0); 505 } else { 506 $_GET['page'] = 1; 507 } 508 } 509 510 $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"; 511 $banners_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows); 512 $banners = $db->Execute($banners_query_raw); 513 while (!$banners->EOF) { 514 $info = $db->Execute("select sum(banners_shown) as banners_shown, 515 sum(banners_clicked) as banners_clicked 516 from " . TABLE_BANNERS_HISTORY . " 517 where banners_id = '" . (int)$banners->fields['banners_id'] . "'"); 518 519 if ((!isset($_GET['bID']) || (isset($_GET['bID']) && ($_GET['bID'] == $banners->fields['banners_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) { 520 $bInfo_array = array_merge($banners->fields, $info->fields); 521 $bInfo = new objectInfo($bInfo_array); 522 } 523 524 $banners_shown = ($info->fields['banners_shown'] != '') ? $info->fields['banners_shown'] : '0'; 525 $banners_clicked = ($info->fields['banners_clicked'] != '') ? $info->fields['banners_clicked'] : '0'; 526 527 if (isset($bInfo) && is_object($bInfo) && ($banners->fields['banners_id'] == $bInfo->banners_id)) { 528 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"; 529 } else { 530 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"; 531 } 532 ?> 533 <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> 534 <td class="dataTableContent" align="right"><?php echo $banners->fields['banners_group']; ?></td> 535 <td class="dataTableContent" align="right"><?php echo $banners_shown . ' / ' . $banners_clicked; ?></td> 536 <td class="dataTableContent" align="center"> 537 <?php 538 if ($banners->fields['status'] == '1') { 539 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>'; 540 } else { 541 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>'; 542 } 543 ?> 544 </td> 545 <td class="dataTableContent" align="center"> 546 <?php 547 if ($banners->fields['banners_open_new_windows'] == '1') { 548 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>'; 549 } else { 550 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>'; 551 } 552 ?> 553 </td> 554 <td class="dataTableContent" align="center"> 555 <?php 556 if ($banners->fields['banners_on_ssl'] == '1') { 557 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>'; 558 } else { 559 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>'; 560 } 561 ?> 562 </td> 563 <td class="dataTableContent" align="right"><?php echo $banners->fields['banners_sort_order']; ?></td> 564 565 <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> 566 </tr> 567 <?php 568 $banners->MoveNext(); 569 } 570 ?> 571 <tr> 572 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 573 <tr> 574 <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> 575 <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> 576 </tr> 577 <tr> 578 <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> 579 </tr> 580 </table></td> 581 </tr> 582 </table></td> 583 <?php 584 $heading = array(); 585 $contents = array(); 586 switch ($action) { 587 case 'delete': 588 $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>'); 589 590 $contents = array('form' => zen_draw_form('banners', FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $bInfo->banners_id . '&action=deleteconfirm')); 591 $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); 592 $contents[] = array('text' => '<br><b>' . $bInfo->banners_title . '</b>'); 593 if ($bInfo->banners_image) $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_image', 'on', true) . ' ' . TEXT_INFO_DELETE_IMAGE); 594 $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>'); 595 break; 596 default: 597 if (is_object($bInfo)) { 598 $heading[] = array('text' => '<b>' . $bInfo->banners_title . '</b>'); 599 600 $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>'); 601 $contents[] = array('text' => '<br>' . TEXT_BANNERS_DATE_ADDED . ' ' . zen_date_short($bInfo->date_added)); 602 603 if ( (function_exists('imagecreate')) && ($dir_ok) && ($banner_extension) ) { 604 $banner_id = $bInfo->banners_id; 605 $days = '3'; 606 include(DIR_WS_INCLUDES . 'graphs/banner_infobox.php'); 607 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image(DIR_WS_IMAGES . 'graphs/banner_infobox-' . $banner_id . '.' . $banner_extension)); 608 } else { 609 include(DIR_WS_FUNCTIONS . 'html_graphs.php'); 610 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_banner_graph_infoBox($bInfo->banners_id, '3')); 611 } 612 613 $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); 614 615 if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_SCHEDULED_AT_DATE, zen_date_short($bInfo->date_scheduled))); 616 617 if ($bInfo->expires_date) { 618 $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_DATE, zen_date_short($bInfo->expires_date))); 619 } elseif ($bInfo->expires_impressions) { 620 $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions)); 621 } 622 623 if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_BANNERS_STATUS_CHANGE, zen_date_short($bInfo->date_status_change))); 624 } 625 break; 626 } 627 628 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 629 echo ' <td width="25%" valign="top">' . "\n"; 630 631 $box = new box; 632 echo $box->infoBox($heading, $contents); 633 634 echo ' </td>' . "\n"; 635 } 636 ?> 637 </tr> 638 </table></td> 639 </tr> 640 <?php 641 } 642 ?> 643 </table></td> 644 <!-- body_text_eof //--> 645 </tr> 646 </table> 647 <!-- body_eof //--> 648 649 <!-- footer //--> 650 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 651 <!-- footer_eof //--> 652 <br> 653 </body> 654 </html> 655 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |