[ 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) 2004 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: media_types.php 3297 2006-03-28 08:35:01Z drbyte $ 21 // 22 23 require ('includes/application_top.php'); 24 25 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 26 27 if (zen_not_null($action)) { 28 switch ($action) { 29 case 'insert': 30 case 'save': 31 if (isset($_GET['mID'])) $type_id = zen_db_prepare_input($_GET['mID']); 32 if (isset($_POST['type_ext'])) $type_ext = zen_db_prepare_input($_POST['type_ext']); 33 if (isset($_POST['type_name'])) $type_name = zen_db_prepare_input($_POST['type_name']); 34 $sql_data_array = array('type_ext' => $type_ext); 35 36 if ($action == 'insert') { 37 $insert_data_array = array('type_name' => $type_name); 38 39 $sql_data_array = array_merge($sql_data_array, $insert_data_array); 40 41 zen_db_perform(TABLE_MEDIA_TYPES, $sql_data_array); 42 $type_id = zen_db_insert_id(); 43 44 } elseif ($action == 'save') { 45 $insert_data_array = array('type_name' => $type_name); 46 $sql_data_array = array_merge($sql_data_array, $insert_data_array); 47 48 zen_db_perform(TABLE_MEDIA_TYPES, $sql_data_array, 'update', "type_id = '" . (int)$type_id . "'"); 49 } 50 51 zen_redirect(zen_href_link(FILENAME_MEDIA_TYPES, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $type_id)); 52 break; 53 case 'deleteconfirm': 54 // demo active test 55 if (zen_admin_demo()) { 56 $_GET['action']= ''; 57 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 58 zen_redirect(zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'])); 59 } 60 $type_id = zen_db_prepare_input($_GET['mID']); 61 62 $db->Execute("delete from " . TABLE_MEDIA_TYPES . " 63 where type_id = '" . (int)$type_id . "'"); 64 65 66 zen_redirect(zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'])); 67 break; 68 } 69 } 70 ?> 71 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 72 <html <?php echo HTML_PARAMS; ?>> 73 <head> 74 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 75 <title><?php echo TITLE; ?></title> 76 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 77 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 78 <script language="javascript" src="includes/menu.js"></script> 79 <script language="javascript" src="includes/general.js"></script> 80 <script type="text/javascript"> 81 <!-- 82 function init() 83 { 84 cssjsmenu('navbar'); 85 if (document.getElementById) 86 { 87 var kill = document.getElementById('hoverJS'); 88 kill.disabled = true; 89 } 90 } 91 // --> 92 </script> 93 </head> 94 <body onload="init()"> 95 <!-- header //--> 96 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 97 <!-- header_eof //--> 98 99 <!-- body //--> 100 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 101 <tr> 102 <!-- body_text //--> 103 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 104 <tr> 105 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 106 <tr> 107 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 108 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 109 </tr> 110 </table></td> 111 </tr> 112 <tr> 113 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 114 <tr> 115 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 116 <tr class="dataTableHeadingRow"> 117 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MEDIA_TYPE; ?></td> 118 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MEDIA_TYPE_EXT; ?></td> 119 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 120 </tr> 121 <?php 122 $media_type_query_raw = "select * from " . TABLE_MEDIA_TYPES . " order by type_name"; 123 $media_type_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $media_type_query_raw, $media_type_query_numrows); 124 $media_type = $db->Execute($media_type_query_raw); 125 while (!$media_type->EOF) { 126 if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $media_type->fields['type_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) { 127 $mInfo = new objectInfo($media_type->fields); 128 } 129 130 if (isset($mInfo) && is_object($mInfo) && ($media_type->fields['type_id'] == $mInfo->type_id)) { 131 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=edit') . '\'">' . "\n"; 132 } else { 133 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=edit') . '\'">' . "\n"; 134 } 135 ?> 136 <td class="dataTableContent"><?php echo $media_type->fields['type_name']; ?></td> 137 <td class="dataTableContent"><?php echo $media_type->fields['type_ext']; ?></td> 138 <td class="dataTableContent" align="right"> 139 <?php echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?> 140 <?php echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?> 141 <?php if (isset($mInfo) && is_object($mInfo) && ($media_type->fields['type_id'] == $mInfo->type_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, zen_get_all_get_params(array('mID')) . 'mID=' . $media_type->fields['type_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> 142 </td> 143 </tr> 144 <?php 145 $media_type->MoveNext(); 146 } 147 ?> 148 <tr> 149 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 150 <tr> 151 <td class="smallText" valign="top"><?php echo $media_type_split->display_count($media_type_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_MEDIA_TYPES); ?></td> 152 <td class="smallText" align="right"><?php echo $media_type_split->display_links($media_type_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> 153 </tr> 154 </table></td> 155 </tr> 156 <?php 157 if (empty($action)) { 158 ?> 159 <tr> 160 <td align="right" colspan="3" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td> 161 </tr> 162 <?php 163 } 164 ?> 165 </table></td> 166 <?php 167 $heading = array(); 168 $contents = array(); 169 170 switch ($action) { 171 case 'new': 172 $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_MEDIA_TYPE . '</b>'); 173 174 $contents = array('form' => zen_draw_form('media_type', FILENAME_MEDIA_TYPES, 'action=insert', 'post', 'enctype="multipart/form-data"')); 175 $contents[] = array('text' => TEXT_NEW_INTRO); 176 $contents[] = array('text' => '<br>' . TEXT_MEDIA_TYPE_NAME . '<br>' . zen_draw_input_field('type_name', '', zen_set_field_length(TABLE_MEDIA_TYPES, 'type_name'))); 177 $contents[] = array('text' => '<br>' . TEXT_MEDIA_TYPE_EXT . '<br>' . zen_draw_input_field('type_ext', '', zen_set_field_length(TABLE_MEDIA_TYPES, 'type_ext'))); 178 179 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $_GET['mID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 180 break; 181 case 'edit': 182 $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_MEDIA_TYPE . '</b>'); 183 184 $contents = array('form' => zen_draw_form('media_type', FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=save', 'post', 'enctype="multipart/form-data"')); 185 $contents[] = array('text' => TEXT_EDIT_INTRO); 186 187 $contents[] = array('text' => '<br>' . TEXT_MEDIA_TYPE_NAME . '<br>' . zen_draw_input_field('type_name', $mInfo->type_name, zen_set_field_length(TABLE_MEDIA_TYPES, 'type_name'))); 188 189 $contents[] = array('text' => '<br />' . TEXT_MEDIA_TYPE_EXT . '<br>' . zen_draw_input_field('type_ext', $mInfo->type_ext, zen_set_field_length(TABLE_MEDIA_TYPES, 'type_ext'))); 190 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 191 break; 192 case 'delete': 193 $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_MEDIA_TYPES . '</b>'); 194 195 $contents = array('form' => zen_draw_form('media_type', FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=deleteconfirm')); 196 $contents[] = array('text' => TEXT_DELETE_INTRO); 197 $contents[] = array('text' => '<br><b>' . $mInfo->type_name . '</b>'); 198 199 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 200 break; 201 default: 202 if (isset($mInfo) && is_object($mInfo)) { 203 $heading[] = array('text' => '<b>' . $mInfo->type_name . '</b>'); 204 205 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 206 $contents[] = array('text' => '<br>' . TEXT_EXTENSION . ' ' . $mInfo->type_ext); 207 } 208 break; 209 } 210 211 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 212 echo ' <td width="25%" valign="top">' . "\n"; 213 214 $box = new box; 215 echo $box->infoBox($heading, $contents); 216 217 echo ' </td>' . "\n"; 218 } 219 ?> 220 </tr> 221 </table></td> 222 </tr> 223 </table></td> 224 <!-- body_text_eof //--> 225 </tr> 226 </table> 227 <!-- body_eof //--> 228 229 <!-- footer //--> 230 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 231 <!-- footer_eof //--> 232 <br> 233 </body> 234 </html> 235 <?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 |
![]() |