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

Zen Cart 源代码 record_artists.php




下载文件

文件名: record_artists.php
文件类型: PHP文件
文件大小: 18.56 KiB
MD5: 0b292ba0eb5a6954d097b0266d7a9d63

record_artists.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: record_artists.php 19330 2011-08-07 06:32:56Z drbyte $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  13.  
  14.   if (zen_not_null($action)) {
  15.     switch ($action) {
  16.       case 'insert':
  17.       case 'save':
  18.         if (isset($_GET['mID'])) $artists_id = zen_db_prepare_input($_GET['mID']);
  19.         $artists_name = zen_db_prepare_input($_POST['artists_name']);
  20.  
  21.         $sql_data_array = array('artists_name' => $artists_name);
  22.  
  23.         if ($action == 'insert') {
  24.           $insert_sql_data = array('date_added' => 'now()');
  25.  
  26.           $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  27.  
  28.           zen_db_perform(TABLE_RECORD_ARTISTS, $sql_data_array);
  29.           $artists_id = zen_db_insert_id();
  30.         } elseif ($action == 'save') {
  31.           $update_sql_data = array('last_modified' => 'now()');
  32.  
  33.           $sql_data_array = array_merge($sql_data_array, $update_sql_data);
  34.  
  35.           zen_db_perform(TABLE_RECORD_ARTISTS, $sql_data_array, 'update', "artists_id = '" . (int)$artists_id . "'");
  36.         }
  37.  
  38.       if ($_POST['artists_image_manual'] != '') {
  39.         // add image manually
  40.         $artists_image_name = zen_db_input($_POST['img_dir'] . $_POST['artists_image_manual']);
  41.         $db->Execute("update " . TABLE_RECORD_ARTISTS . "
  42.                      set artists_image = '" .  $artists_image_name . "'
  43.                      where artists_id = '" . (int)$artists_id . "'");
  44.       } else {
  45.         $artists_image = new upload('artists_image');
  46.         $artists_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
  47.         if ( $artists_image->parse() &&  $artists_image->save()) {
  48.           // remove image from database if none
  49.           if ($artists_image->filename != 'none') {
  50.             $db->Execute("update " . TABLE_RECORD_ARTISTS . "
  51.                          set artists_image = '" .  zen_db_input($_POST['img_dir'] . $artists_image->filename) . "'
  52.                          where artists_id = '" . (int)$artists_id . "'");
  53.           } else {
  54.             $db->Execute("update " . TABLE_RECORD_ARTISTS . "
  55.                          set artists_image = ''
  56.                          where artists_id = '" . (int)$artists_id . "'");
  57.           }
  58.         }
  59.       }
  60.  
  61.         $languages = zen_get_languages();
  62.         for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  63.           $artists_url_array = $_POST['artists_url'];
  64.           $language_id = $languages[$i]['id'];
  65.  
  66.           $sql_data_array = array('artists_url' => zen_db_prepare_input($artists_url_array[$language_id]));
  67.  
  68.           if ($action == 'insert') {
  69.             $insert_sql_data = array('artists_id' => $artists_id,
  70.                                      'languages_id' => $language_id);
  71.  
  72.             $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  73.  
  74.             zen_db_perform(TABLE_RECORD_ARTISTS_INFO, $sql_data_array);
  75.           } elseif ($action == 'save') {
  76.             zen_db_perform(TABLE_RECORD_ARTISTS_INFO, $sql_data_array, 'update', "artists_id = '" . (int)$artists_id . "' and languages_id = '" . (int)$language_id . "'");
  77.           }
  78.         }
  79.  
  80.         zen_redirect(zen_href_link(FILENAME_RECORD_ARTISTS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $artists_id));
  81.         break;
  82.       case 'deleteconfirm':
  83.         // demo active test
  84.         if (zen_admin_demo()) {
  85.           $_GET['action']= '';
  86.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  87.           zen_redirect(zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page']));
  88.         }
  89.         $artists_id = zen_db_prepare_input($_POST['mID']);
  90.  
  91.         if (isset($_POST['delete_image']) && ($_POST['delete_image'] == 'on')) {
  92.  
  93.           $manufacturer = $db->Execute("select artists_image
  94.                                        from " . TABLE_RECORD_ARTISTS . "
  95.                                        where artists_id = '" . (int)$artists_id . "'");
  96.           $image_location = DIR_FS_CATALOG_IMAGES . $manufacturer->fields['artists_image'];
  97.  
  98.           if (file_exists($image_location)) @unlink($image_location);
  99.         }
  100.  
  101.         $db->Execute("delete from " . TABLE_RECORD_ARTISTS . "
  102.                      where artists_id = '" . (int)$artists_id . "'");
  103.         $db->Execute("delete from " . TABLE_RECORD_ARTISTS_INFO . "
  104.                      where artists_id = '" . (int)$artists_id . "'");
  105.  
  106.         if (isset($_POST['delete_products']) && ($_POST['delete_products'] == 'on')) {
  107.           $products = $db->Execute("select products_id
  108.                                    from " . TABLE_PRODUCT_MUSIC_EXTRA . "
  109.                                    where artists_id = '" . (int)$artists_id . "'");
  110.  
  111.           while (!$products->EOF) {
  112.             zen_remove_product($products->fields['products_id']);
  113.             $products->MoveNext();
  114.           }
  115.         } else {
  116.           $db->Execute("update " . TABLE_PRODUCT_MUSIC_EXTRA . "
  117.                        set artists_id = ''
  118.                        where artists_id = '" . (int)$artists_id . "'");
  119.         }
  120.  
  121.         zen_redirect(zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page']));
  122.         break;
  123.     }
  124.   }
  125. ?>
  126. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  127. <html <?php echo HTML_PARAMS; ?>>
  128. <head>
  129. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  130. <title><?php echo TITLE; ?></title>
  131. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  132. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  133. <script language="javascript" src="includes/menu.js"></script>
  134. <script language="javascript" src="includes/general.js"></script>
  135. <script type="text/javascript">
  136.   <!--
  137.   function init()
  138.   {
  139.     cssjsmenu('navbar');
  140.     if (document.getElementById)
  141.     {
  142.       var kill = document.getElementById('hoverJS');
  143.       kill.disabled = true;
  144.     }
  145.   }
  146.   // -->
  147. </script>
  148. </head>
  149. <body onload="init()">
  150. <!-- header //-->
  151. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  152. <!-- header_eof //-->
  153.  
  154. <!-- body //-->
  155. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  156.   <tr>
  157. <!-- body_text //-->
  158.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  159.       <tr>
  160.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  161.           <tr>
  162.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  163.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  164.           </tr>
  165.         </table></td>
  166.       </tr>
  167.       <tr>
  168.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  169.           <tr>
  170.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  171.               <tr class="dataTableHeadingRow">
  172.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_RECORD_ARTISTS; ?></td>
  173.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  174.               </tr>
  175. <?php
  176.   $artists_query_raw = "select * from " . TABLE_RECORD_ARTISTS . " order by artists_name";
  177.   $artists_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $artists_query_raw, $artists_query_numrows);
  178.   $artists = $db->Execute($artists_query_raw);
  179.  
  180.   while (!$artists->EOF) {
  181.  
  182.     if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $artists->fields['artists_id']))) && !isset($aInfo) && (substr($action, 0, 3) != 'new')) {
  183.       $artists_products = $db->Execute("select count(*) as products_count
  184.                                             from " . TABLE_PRODUCT_MUSIC_EXTRA . "
  185.                                             where artists_id = '" . (int)$artists->fields['artists_id'] . "'");
  186.  
  187.       $aInfo_array = array_merge($artists->fields, $artists_products->fields);
  188.       $aInfo = new objectInfo($aInfo_array);
  189.     }
  190.  
  191.     if (isset($aInfo) && is_object($aInfo) && ($artists->fields['artists_id'] == $aInfo->artists_id)) {
  192.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $artists->fields['artists_id'] . '&action=edit') . '\'">' . "\n";
  193.     } else {
  194.       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $artists->fields['artists_id'] . '&action=edit') . '\'">' . "\n";
  195.     }
  196. ?>
  197.                 <td class="dataTableContent"><?php echo $artists->fields['artists_name']; ?></td>
  198.                 <td class="dataTableContent" align="right">
  199.                   <?php echo '<a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $artists->fields['artists_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
  200.                   <?php echo '<a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $artists->fields['artists_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
  201.                   <?php if (isset($aInfo) && is_object($aInfo) && ($artists->fields['artists_id'] == $aInfo->artists_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, zen_get_all_get_params(array('mID')) . 'mID=' . $artists->fields['artists_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
  202.                 </td>
  203.               </tr>
  204. <?php
  205.     $artists->MoveNext();
  206.   }
  207. ?>
  208.               <tr>
  209.                 <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  210.                   <tr>
  211.                     <td class="smallText" valign="top"><?php echo $artists_split->display_count($artists_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ARTISTS); ?></td>
  212.                     <td class="smallText" align="right"><?php echo $artists_split->display_links($artists_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  213.                   </tr>
  214.                 </table></td>
  215.               </tr>
  216. <?php
  217.   if (empty($action)) {
  218. ?>
  219.               <tr>
  220.                 <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $aInfo->artists_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
  221.               </tr>
  222. <?php
  223.   }
  224. ?>
  225.             </table></td>
  226. <?php
  227.   $heading = array();
  228.   $contents = array();
  229.  
  230.   switch ($action) {
  231.     case 'new':
  232.       $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_RECORD_ARTIST . '</b>');
  233.  
  234.       $contents = array('form' => zen_draw_form('artists', FILENAME_RECORD_ARTISTS, 'action=insert', 'post', 'enctype="multipart/form-data"'));
  235.       $contents[] = array('text' => TEXT_NEW_INTRO);
  236.       $contents[] = array('text' => '<br>' . TEXT_RECORD_ARTIST_NAME . '<br>' . zen_draw_input_field('artists_name', '', zen_set_field_length(TABLE_RECORD_ARTISTS, 'artists_name')));
  237.       $contents[] = array('text' => '<br>' . TEXT_RECORD_ARTIST_IMAGE . '<br>' . zen_draw_file_field('artists_image'));
  238.       $dir = @dir(DIR_FS_CATALOG_IMAGES);
  239.       $dir_info[] = array('id' => '', 'text' => "Main Directory");
  240.       while ($file = $dir->read()) {
  241.         if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
  242.           $dir_info[] = array('id' => $file . '/', 'text' => $file);
  243.         }
  244.       }
  245.       $dir->close();
  246.  
  247.       $default_directory = 'artists/';
  248.  
  249.       $contents[] = array('text' => '<BR />' . TEXT_ARTISTS_IMAGE_DIR . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory));
  250.       $contents[] = array('text' => '<br />' . TEXT_ARTISTS_IMAGE_MANUAL . '&nbsp;' . zen_draw_input_field('artists_image_manual'));
  251.  
  252.       $manufacturer_inputs_string = '';
  253.       $languages = zen_get_languages();
  254.       for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  255.         $manufacturer_inputs_string .= '<br>' . zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . zen_draw_input_field('artists_url[' . $languages[$i]['id'] . ']', '', zen_set_field_length(TABLE_RECORD_ARTISTS_INFO, 'artists_url') );
  256.       }
  257.  
  258.       $contents[] = array('text' => '<br>' . TEXT_RECORD_ARTIST_URL . $manufacturer_inputs_string);
  259.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $_GET['mID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  260.       break;
  261.     case 'edit':
  262.       $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_RECORD_ARTIST . '</b>');
  263.  
  264.       $contents = array('form' => zen_draw_form('artists', FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $aInfo->artists_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
  265.       $contents[] = array('text' => TEXT_EDIT_INTRO);
  266.       $contents[] = array('text' => '<br />' . TEXT_RECORD_ARTIST_NAME . '<br>' . zen_draw_input_field('artists_name', htmlspecialchars($aInfo->artists_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_RECORD_ARTISTS, 'artists_name')));
  267.       $contents[] = array('text' => '<br />' . TEXT_RECORD_ARTIST_IMAGE . '<br>' . zen_draw_file_field('artists_image') . '<br />' . $aInfo->artists_image);
  268.       $dir = @dir(DIR_FS_CATALOG_IMAGES);
  269.       $dir_info[] = array('id' => '', 'text' => "Main Directory");
  270.       while ($file = $dir->read()) {
  271.         if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
  272.           $dir_info[] = array('id' => $file . '/', 'text' => $file);
  273.         }
  274.       }
  275.       $dir->close();
  276.       $default_directory = substr( $aInfo->artists_image, 0,strpos( $aInfo->artists_image, '/')+1);
  277.       $contents[] = array('text' => '<BR />' . TEXT_ARTISTS_IMAGE_DIR . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory));
  278.       $contents[] = array('text' => '<br />' . TEXT_ARTISTS_IMAGE_MANUAL . '&nbsp;' . zen_draw_input_field('artists_image_manual'));
  279.       $contents[] = array('text' => '<br />' . zen_info_image($aInfo->artists_image, $aInfo->artists_name));
  280.       $manufacturer_inputs_string = '';
  281.       $languages = zen_get_languages();
  282.       for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  283.         $manufacturer_inputs_string .= '<br>' . zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . zen_draw_input_field('artists_url[' . $languages[$i]['id'] . ']', zen_get_artists_url($aInfo->artists_id, $languages[$i]['id']), zen_set_field_length(TABLE_RECORD_ARTISTS_INFO, 'artists_url'));
  284.       }
  285.  
  286.       $contents[] = array('text' => '<br>' . TEXT_RECORD_ARTIST_URL . $manufacturer_inputs_string);
  287.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $aInfo->artists_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  288.       break;
  289.     case 'delete':
  290.       $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_RECORD_ARTIST . '</b>');
  291.  
  292.       $contents = array('form' => zen_draw_form('artists', FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('mID', $aInfo->artists_id));
  293.       $contents[] = array('text' => TEXT_DELETE_INTRO);
  294.       $contents[] = array('text' => '<br><b>' . $aInfo->artists_name . '</b>');
  295.       $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE);
  296.  
  297.       if ($aInfo->products_count > 0) {
  298.         $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
  299.         $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $aInfo->products_count));
  300.       }
  301.  
  302.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $aInfo->artists_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  303.       break;
  304.     default:
  305.       if (isset($aInfo) && is_object($aInfo)) {
  306.         $heading[] = array('text' => '<b>' . $aInfo->artists_name . '</b>');
  307.  
  308.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $aInfo->artists_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_RECORD_ARTISTS, 'page=' . $_GET['page'] . '&mID=' . $aInfo->artists_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  309.         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($aInfo->date_added));
  310.         if (zen_not_null($aInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($aInfo->last_modified));
  311.         $contents[] = array('text' => '<br>' . zen_info_image($aInfo->artists_image, $aInfo->artists_name));
  312.         $contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $aInfo->products_count);
  313.       }
  314.       break;
  315.   }
  316.  
  317.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  318.     echo '            <td width="25%" valign="top">' . "\n";
  319.  
  320.     $box = new box;
  321.     echo $box->infoBox($heading, $contents);
  322.  
  323.     echo '            </td>' . "\n";
  324.   }
  325. ?>
  326.           </tr>
  327.         </table></td>
  328.       </tr>
  329.     </table></td>
  330. <!-- body_text_eof //-->
  331.   </tr>
  332. </table>
  333. <!-- body_eof //-->
  334.  
  335. <!-- footer //-->
  336. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  337. <!-- footer_eof //-->
  338. <br>
  339. </body>
  340. </html>
  341. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  342.  


cron