add(TEXT_WARNING_FOLDER_UNWRITABLE, 'caution'); break; case 'remove_product': $db->Execute("delete from " . TABLE_MEDIA_TO_PRODUCTS . " where media_id = '" . (int)$_GET['mID'] . "' and product_id = '" . (int)$_GET['product_id'] . "'"); zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'action=products¤t_category_id=' . $current_category_id) . '&mID=' . (int)$_GET['mID'] . '&page=' . $_GET['page']); break; case 'add_product': $product_add_query = $db->Execute("insert into " . TABLE_MEDIA_TO_PRODUCTS . " (media_id, product_id) values ('" . (int)$_GET['mID'] . "', '" . (int)$_GET['current_product_id'] . "')"); zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'action=products¤t_category_id=' . $current_category_id) . '&mID=' . $_GET['mID'] . '&page=' . $_GET['page']); break; case 'new_cat': $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id); $products_filter = $new_product_query->fields['products_id']; zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'action=products¤t_category_id=' . $current_category_id . '&mID=' . $_GET['mID'] . '&page=' . $_GET['page'])); break; case 'remove_clip': $delete_query = "delete from " . TABLE_MEDIA_CLIPS . " where clip_id = '" . $_GET['clip_id'] . "'"; $db->Execute($delete_query); zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'action=edit&page=' . $_GET['page'])); break; case 'insert': case 'save': if (isset($_POST['add_clip'])) { $clip_name = $_FILES['clip_filename']; $clip_name = zen_db_prepare_input($clip_name['name']); if ($clip_name) { $media_type = $_POST['media_type']; $ext = $db->Execute("select type_ext from " . TABLE_MEDIA_TYPES . " where type_id = '" . $_POST['media_type'] . "'"); if (ereg($ext->fields['type_ext'], $clip_name)) { if ($media_upload = new upload('clip_filename')) { $media_upload->set_destination(DIR_FS_CATALOG_MEDIA . $_POST['media_dir']); if ($media_upload->parse() && $media_upload->save()) { $media_upload_filename = $_POST['media_dir'] . $media_upload->filename; } if ($media_upload->filename != 'none' && $media_upload->filename != '' && is_writable(DIR_FS_CATALOG_MEDIA . $_POST['media_dir'])) { $db->Execute("insert into " . TABLE_MEDIA_CLIPS . " (media_id, clip_type, clip_filename, date_added) values ( '" . $_GET['mID'] . "', '" . $media_type . "', '" . $media_upload_filename . "', now())"); } } } } } if (isset($_GET['mID'])) $media_id = zen_db_prepare_input($_GET['mID']); $media_name = zen_db_prepare_input($_POST['media_name']); $sql_data_array = array('media_name' => $media_name); if ($media_name == '') { $messageStack->add_session(ERROR_UNKNOWN_DATA, 'caution'); } else { if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_MEDIA_MANAGER, $sql_data_array); $media_id = zen_db_insert_id(); } elseif ($action == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); zen_db_perform(TABLE_MEDIA_MANAGER, $sql_data_array, 'update', "media_id = '" . (int)$media_id . "'"); } } zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . ($media_id != '' ? 'mID=' . $media_id : ''))); break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action']= ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'page=' . $_GET['page'])); } $media_id = zen_db_prepare_input($_GET['mID']); $db->Execute("delete from " . TABLE_MEDIA_MANAGER . " where media_id = '" . (int)$media_id . "'"); if (isset($_POST['delete_products']) && ($_POST['delete_products'] == 'on')) { // while (!$products->EOF) { // zen_remove_product($products->fields['products_id']); // $products->MoveNext(); // } } else { // $db->Execute("update " . TABLE_PRODUCTS . " // set manufacturers_id = '' // where manufacturers_id = '" . (int)$manufacturers_id . "'"); } zen_redirect(zen_href_link(FILENAME_MEDIA_MANAGER, 'page=' . $_GET['page'])); break; } } ?> > <?php echo TITLE; ?>
'' . TEXT_HEADING_NEW_MEDIA_COLLECTION . ''); $contents = array('form' => zen_draw_form('collections', FILENAME_MEDIA_MANAGER, 'action=insert&page=' . $_GET['page'], 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_NEW_INTRO); $contents[] = array('text' => '
' . TEXT_MEDIA_COLLECTION_NAME . '
' . zen_draw_input_field('media_name', '', zen_set_field_length(TABLE_MEDIA_MANAGER, 'media_name'))); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'edit': $heading[] = array('text' => '' . TEXT_HEADING_EDIT_MEDIA_COLLECTION . ''); $contents = array('form' => zen_draw_form('collections', FILENAME_MEDIA_MANAGER, 'page=' . $_GET['page'] . '&mID=' . $mInfo->media_id . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_EDIT_INTRO); $contents[] = array('text' => '
' . TEXT_MEDIA_COLLECTION_NAME . '
' . zen_draw_input_field('media_name', $mInfo->media_name, zen_set_field_length(TABLE_MEDIA_MANAGER, 'media_name'))); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); $contents[] = array('text' => zen_draw_separator('pixel_black.gif')); $contents[] = array('text' => TEXT_MEDIA_EDIT_INSTRUCTIONS); $contents[] = array('text' => zen_draw_separator('pixel_black.gif')); $dir = @dir(DIR_FS_CATALOG_MEDIA); $dir_info[] = array('id' => '', 'text' => "Main Directory"); while ($file = $dir->read()) { if (@is_dir(DIR_FS_CATALOG_MEDIA . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") { $dir_info[] = array('id' => $file . '/', 'text' => $file); } } $dir->close(); $contents[] = array('text' => '
' . TEXT_ADD_MEDIA_CLIP . zen_draw_file_field('clip_filename')); $contents[] = array('text' => TEXT_MEDIA_CLIP_DIR . ' ' . zen_draw_pull_down_menu('media_dir', $dir_info)); $media_type_query = "select type_id, type_name, type_ext from " . TABLE_MEDIA_TYPES; $media_types = $db->Execute($media_type_query); while (!$media_types->EOF) { $media_types_array[] = array('id' => $media_types->fields['type_id'], 'text' => $media_types->fields['type_name'] . ' (' . $media_types->fields['type_ext'] . ')'); $media_types->MoveNext(); } $contents[] = array('text' => TEXT_MEDIA_CLIP_TYPE . ' ' . zen_draw_pull_down_menu('media_type', $media_types_array)); $contents[] = array('text' => ''); $clip_query = "select * from " . TABLE_MEDIA_CLIPS . " where media_id = '" . $mInfo->media_id . "'"; $clips = $db->Execute($clip_query); while (!$clips->EOF) { $contents[] = array('text' => '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ' ' . $clips->fields['clip_filename'] . '
'); $clips->MoveNext(); } break; case 'delete': $heading[] = array('text' => '' . TEXT_HEADING_DELETE_MEDIA_COLLECTION . ''); $contents = array('form' => zen_draw_form('collections', FILENAME_MEDIA_MANAGER, 'page=' . $_GET['page'] . '&mID=' . $mInfo->media_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_DELETE_INTRO); $contents[] = array('text' => '
' . $mInfo->media_name . ''); if ($mInfo->products_count > 0) { $contents[] = array('text' => '
' . zen_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS); $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $mInfo->products_count)); } $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'products': $new_product_query = $db->Execute("select ptc.*, pd.products_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' where ptc.categories_id='" . $current_category_id . "' order by pd.products_name"); $heading[] = array('text' => '' . TEXT_HEADING_ASSIGN_MEDIA_COLLECTION . ''); $contents[] = array('text' => TEXT_PRODUCTS_INTRO . '

'); $contents[] = array('text' => zen_draw_form('new_category', FILENAME_MEDIA_MANAGER, '', 'get') . '  ' . zen_draw_pull_down_menu('current_category_id', zen_get_category_tree('', '', '0'), '', 'onChange="this.form.submit();"') . zen_hide_session_id() . zen_draw_hidden_field('products_filter', $_GET['products_filter']) . zen_draw_hidden_field('action', 'new_cat') . zen_draw_hidden_field('mID', $mInfo->media_id) . zen_draw_hidden_field('page', $_GET['page']) . '  '); $product_array = $zc_products->get_products_in_category($current_category_id, false); if ($product_array) { $contents[] = array('text' => zen_draw_form('new_product', FILENAME_MEDIA_MANAGER, '', 'get') . '  ' . zen_draw_pull_down_menu('current_product_id', $product_array) . ' ' . '' . zen_draw_hidden_field('current_category_id', $current_category_id) . zen_draw_hidden_field('action', 'add_product') . zen_draw_hidden_field('page', $_GET['page']) . zen_draw_hidden_field('mID', $mInfo->media_id) . '  '); } else { $contents[] = array('text' => '  ' . TEXT_NO_PRODUCTS); } $products_linked_query = "select * from " . TABLE_MEDIA_TO_PRODUCTS . " where media_id = '" . $mInfo->media_id . "'"; $products_linked = $db->Execute($products_linked_query); while (!$products_linked->EOF) { $contents[] = array('text' => '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ' ' . $zc_products->products_name($products_linked->fields['product_id']) . '
'); $products_linked->MoveNext(); } $contents[] = array('align' => 'center', 'text' => '
' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (isset($mInfo) && is_object($mInfo)) { $heading[] = array('text' => '' . $mInfo->media_name . ''); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ' ' . '' . zen_image_button('button_assign_to_product.gif', IMAGE_PRODUCTS) . ''); $contents[] = array('text' => '
' . TEXT_DATE_ADDED . ' ' . zen_date_short($mInfo->date_added)); if (zen_not_null($mInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($mInfo->last_modified)); $products_linked_query = "select product_id from " . TABLE_MEDIA_TO_PRODUCTS . " where media_id = '" . $mInfo->media_id . "'"; $products_linked = $db->Execute($products_linked_query); $contents[] = array('text' => '
' . TEXT_PRODUCTS . ' ' . $products_linked->RecordCount()); $clip_query = "select clip_id from " . TABLE_MEDIA_CLIPS . " where media_id = '" . $mInfo->media_id . "'"; $clips = $db->Execute($clip_query); $contents[] = array('text' => TEXT_CLIPS . ' ' . $clips->RecordCount()); } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo ' ' . "\n"; } ?>
Execute($media_query_raw); while (!$media->EOF) { if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $media->fields['media_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) { $mInfo = new objectInfo($media->fields); } if (isset($mInfo) && is_object($mInfo) && ($media->fields['media_id'] == $mInfo->media_id)) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?> MoveNext(); } ?>
 
fields['media_name']; ?> fields['media_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . ''; ?> fields['media_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . ''; ?> fields['media_id'] == $mInfo->media_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?>
display_count($media_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_MEDIA); ?> display_links($media_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?>
media_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . ''; ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '