[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 源代码 media_manager.php

Zen Cart 源代码 media_manager.php




下载文件

文件名: media_manager.php
文件类型: PHP文件
文件大小: 2.93 KiB
MD5: 8b0e6c0ffe2084537db3760044a656c0

media_manager.php - 关闭高亮
  1. <?php
  2. /**
  3.  * iterates thru media collections/clips
  4.  *
  5.  * @package productTypes
  6.  * @copyright Copyright 2003-2009 Zen Cart Development Team
  7.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  8.  * @version $Id: media_manager.php 11825 2009-01-15 09:46:19Z drbyte $
  9.  */
  10. if (!defined('IS_ADMIN_FLAG')) {
  11.   die('Illegal Access');
  12. }
  13.  
  14. /**
  15.  * get list of media collections assigned to specified product
  16.  */
  17. $zv_collection_query = "select media_id, product_id from " . TABLE_MEDIA_TO_PRODUCTS . "
  18.                        where product_id = '" . (int)$_GET['products_id'] . "'";
  19. $zq_collections = $db->Execute($zv_collection_query);
  20. $zv_product_has_media = false;
  21. /**
  22.  * loop thru collections to identify actual media clips
  23.  */
  24. if ($zq_collections->RecordCount() > 0) {
  25.   $zv_product_has_media = true;
  26.   while (!$zq_collections->EOF) {
  27.     /**
  28.      * get names of assigned media collections
  29.      */
  30.     $zf_media_manager_query = "select media_id, media_name from " . TABLE_MEDIA_MANAGER . "
  31.                               where media_id = '" . (int)$zq_collections->fields['media_id'] . "'";
  32.     $zq_media_manager = $db->Execute($zf_media_manager_query);
  33.     if ($zq_media_manager->RecordCount() < 1) {
  34.       $zv_product_has_media = false;
  35.     } else {
  36.       /**
  37.        * build array of [collection_id][text] = collection-name
  38.        */
  39.       $za_media_manager[$zq_media_manager->fields['media_id']] = array('text' => $zq_media_manager->fields['media_name']);
  40.       /**
  41.        * get list of media clips associated with the current media collection, sorted by filename (to allow display sort order to be controlled by filename)
  42.        */
  43.       $zv_clips_query = "select media_id, clip_id, clip_filename, clip_type from " . TABLE_MEDIA_CLIPS . "
  44.                         where media_id = '" . (int)$zq_media_manager->fields['media_id'] . "' order by clip_filename";
  45.       $zq_clips = $db->Execute($zv_clips_query);
  46.       if ($zq_clips->RecordCount() < 1) {
  47.         $zv_product_has_media = false;
  48.       } else {
  49.         while (!$zq_clips->EOF) {
  50.           /**
  51.            * get list of media types and filenames associated with the current media
  52.            * @TODO - run this as separate static array, since only needs to run once, not repeatedly in a loop
  53.            */
  54.           $zf_clip_type_query = "select type_ext, type_name from " . TABLE_MEDIA_TYPES . "
  55.                                 where type_id = '" . (int)$zq_clips->fields['clip_type'] . "'";
  56.  
  57.           $zq_clip_type = $db->Execute($zf_clip_type_query);
  58.  
  59.           $za_media_manager[$zq_media_manager->fields['media_id']]['clips'][$zq_clips->fields['clip_id']] =
  60.                 array('clip_filename' => $zq_clips->fields['clip_filename'],
  61.                       'clip_type' => $zq_clip_type->fields['type_name']);
  62.           $zq_clips->MoveNext();
  63.         }
  64.       }
  65.     }
  66.     $zq_collections->MoveNext();
  67.   }
  68. }
  69. $zv_product_has_media = (sizeof($za_media_manager)) > 0 ? TRUE : FALSE;