Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Video addon issue


jey

Recommended Posts

we are using following video upload addon in our shop. everthing working fine. but if we edit the clip Name it will be create new file, not updated

 

Please check the code and give me the solution.

 

http://addons.oscommerce.com/info/5971/v,22

 

<?php
/*
 $Id: catalog/admin/cs_av.php,v 1.0 20:57:52 NCB Exp $
 by hanuman at Open Source Services
 Upgrade at http://www.open-source-services.com/index.php/Open-Source-Services-Products/cinesound-audio-visual-overview.html
 Support and Forum at http://www.open-source-services.com/index.php/component/option,com_kunena/Itemid,18/catid,57/func,showcat
*/
require('includes/application_top.php');
require(DIR_WS_FUNCTIONS . 'cs_av.php');

$action = (isset($_GET['action']) ? $_GET['action'] : '');
$poscode = $fm_name = $arr_all_pos = $unit_name = '';
$show_values = $show_unit_settings = $units_exist = $new_unit = false;
$no_errors = true;
$errors = array();
if (tep_not_null($action)) {
 switch ($action) {

  case 'new_unit':
$show_unit_settings = $new_unit = true;
  break;

  case 'edit_unit':
$show_unit_settings = $show_values = true;
$unit_name = $_GET['cs_name'];
  break;

  case 'new_pos':

if(isset($_POST['pos_name']) && ($_POST['pos_name']!='')) {  
saveNewPos($_POST['pos_name']);
tep_redirect(tep_href_link(FILENAME_CS_AV, 'action=pos_man'));
}

  break;

  case 'del_pos':

$chk_no = $_POST['chk_count'];
  $pos_to_delete = array();
for($i = 0; $i < $chk_no; $i++) {
 $checkbox_id = 'check' . $i;
 if(isset($_POST[$checkbox_id])) {
  $pos_to_delete[] = $_POST[$checkbox_id];
 }
}

for($a = 0; $a < count($pos_to_delete); $a++) {
 delPos($pos_to_delete[$a]);
}
 tep_redirect(tep_href_link(FILENAME_CS_AV, 'action=pos_man'));

  break;

  case 'pos_man':

$arr_all_pos = getAllPos();

  break;

  case 'delete_units':

  echo 'delete'.$_POST['chk_count'];

  if(isset($_POST['chk_count'])){

   $units_to_del = array();
   $chk_no = $_POST['chk_count'];

   for($i = 0; $i < $chk_no; $i++) {
	$checkbox_id = 'check' . $i;
	if(isset($_POST[$checkbox_id])) {
	 $units_to_del[] = $_POST[$checkbox_id];
	}
   }
   if(count($units_to_del) > 0) {
	for($x=0; $x < count($units_to_del); $x++) {
	 $unit_name = tep_db_prepare_input($units_to_del[$x]);
	 deleteUnit($unit_name);
	}
 }	
  }	
 break;  

  case 'save_av_unit':

if((strlen($_POST['cs_name']) < 4) || (strlen($_POST['cs_name']) > 99)) {
 $no_errors = false;
 $errors[] = CS_ERROR_NAME_LENGTH;
}
if($_FILES['cs_userfile']['name']  == ''){
} else {
 $_POST['filename'] = $_FILES['cs_userfile']['name'];
 $save_path=DIR_FS_CATALOG . "av/cinesound_av/";
 move_uploaded_file($_FILES['cs_userfile']['tmp_name'], $save_path . $_FILES['cs_userfile']['name']);
}
if($_POST['active'] == CS_PLEASE_SELECT) {
 $no_errors = false;
 $errors[] = CS_ERROR_SET_ACTIVE;
}

if((strlen($_POST['pages']) < 6) || (strlen($_POST['pages']) > 299)) {
 $no_errors = false;
 $errors[] = CS_ERROR_SET_PAGES;
}

if($_POST['position'] == CS_PLEASE_SELECT) {
 $no_errors = false;
 $errors[] = CS_ERROR_SET_POSITION;
}

  if($no_errors) {
saveSettings($_POST);
  }

  tep_redirect(tep_href_link(FILENAME_CS_AV, 'action=edit_unit&cs_name='.$_POST['cs_name']));

  break;

 }

}
$arr_all_units = getAllUnits();
if(tep_db_fetch_array($arr_all_units))  {
 $units_exist = true;
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script type='text/javascript' src="js/silverlight.js"></script>
<script type='text/javascript' src="js/wmvplayer.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="1" class="columnLeft">
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
</table></td>
<td width="100%" valign="top">
 <table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
 <td width="100%">
 <table width="100%" cellpadding="0" cellspacing="0" border="0">
 <tr>
 <td width="70%" class="pageHeading"><?php echo CS_TITLE; ?>
 </td>
 <td align="right" class="smallText"></td>
  </tr>
  </table>
  </td>
</tr>
<?php  if(!$units_exist)  { ?>
 <tr>
  <td class="smallText" align="center"> <?php echo CS_NO_UNITS; ?>
  </td>
 </tr>
<?php } ?>
 <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
 <tr>
  <td><table cellpadding="0" cellspacing="0" border="0" align="center"><tr><td style="width:130px">
<a href="<?php echo FILENAME_CS_AV . '?action=new_unit'; ?>">
<?php echo tep_image_button('cs_new_content.gif', 'Create new a/v unit', 'Create new a/v unit'); ?>
</a>
  </td>
		<td><a href="<?php echo tep_href_link(FILENAME_CS_AV, 'action=pos_man', 'NONSSL'); ?>"><?php echo CS_POS_MAN; ?></a></td>
		</tr></table></td>
 </tr>
 <?php

if($units_exist){
?>
<tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
 <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<tr>
	<td><form name="ads_list" action="<?php echo tep_href_link(FILENAME_CS_AV, 'action=delete_units', 'NONSSL'); ?>" method="post">
	 <table align="center" border="0" width="90%" cellspacing="0" cellpadding="0">
	   <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
		 <td valign="top"><table border="1" width="100%" cellspacing="0" cellpadding="2" rules="none" frame="box">
		   <tr class="dataTableHeadingRow">
			 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CS_NAME; ?></td>
			 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CS_FILE; ?></td>
			 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CS_DESCRIPTION; ?></td>
			 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CS_POSITION; ?></td>
			 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CS_PAGES; ?></td>
			 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CS_ACTIVE; ?></td>
			 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_EDIT; ?></td>
			 <td class="dataTableHeadingContent"><img src='images/icons/delete.gif'/></td>
		   </tr>
<?php
$chbx_counter = 0;
$rows = 0;
mysql_data_seek($arr_all_units,0);
 while ($cs = tep_db_fetch_array($arr_all_units)) {
 $rows++;
?>
	<tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
			<td class="dataTableContent"><?php echo $cs['cs_name']; ?></td>
			<td class="dataTableContent"><?php echo $cs['filename']; ?></td>
			<td class="dataTableContent"><?php echo $cs['description']; ?></td>
			<td class="dataTableContent"><?php echo $cs['position']; ?></td>
			<td class="dataTableContent"><?php echo $cs['pages']; ?></td>
			<td class="dataTableContent"><?php echo $cs['active']; ?></td>
			<td class="dataTableContent"><?php echo '<a class="headerLink" href="' . FILENAME_CS_AV . '?action=edit_unit&cs_name=' . $cs['cs_name'] . '"><img src="images/icons/edit.gif" border="0"/></a>'; ?></td>
			<td class="dataTableContent"><?php echo '<input type="checkbox" name="check' . $chbx_counter . '" value="' . $cs['cs_name'] . '" />';?></td>
		   </tr>
<?php $chbx_counter++; } ?>
		 </td>
	   </tr>		  
	   <tr>
	  <td colspan="9" align="right">
	   <input type="hidden" name="chk_count" value="<?php echo $chbx_counter; ?>">
	   <?php echo tep_image_submit('cs_button_delete.gif', IMAGE_DELETE); ?>		  
	  </td>
	 </tr>
	 </table></form>
   </td>
 </tr>
<?php } if($show_unit_settings) {
 if(!$new_unit) {
  mysql_data_seek($arr_all_units,0);
  while($arrdetail = tep_db_fetch_array($arr_all_units)) {
   if($arrdetail['cs_name'] == $unit_name)break;
  }
 }
  ?>
 <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
 <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
 <tr>
  <td align="center">
   <table>
   <tr><td align="center">
   <form enctype="multipart/form-data" action="<?php echo tep_href_link(FILENAME_CS_AV, 'action=save_av_unit', 'NONSSL'); ?>" method="post">
   <table align="center" border="1" rules="none" frame="box">
	<tr class="dataTableHeadingRow">
	 <td class="dataTableHeadingContent" align="right" colspan="2"><?php echo CS_SETTINGS; ?>                <span class="smallText"><?php echo CS_REQUIRED; ?></span></td>	  
	</tr>
	<tr class="attributes-odd">
	 <td class="dataTableContent"><?php echo TABLE_HEADING_CS_NAME; ?></td>
	 <td class="dataTableContent"><input type="text" name="cs_name" value="<?php if($show_values) echo $arrdetail['cs_name']; ?>" />*</td>
	</tr>
	<tr class="attributes-odd">
	 <td valign="top" class="dataTableContent"><?php echo TABLE_HEADING_CS_FILE; ?></td>
	 <td class="dataTableContent">
	 <?php if((isset($arrdetail))&&($arrdetail['filename'] != '')){ ?>
	  <input type="text" name="xyz" value="<?php if($show_values) echo $arrdetail['filename']; ?>" DISABLED /><br/>
	  <input type="hidden" name="filename" value="<?php echo $arrdetail['filename']; ?>" /><br/>		
	<?php } ?>
	  <input type="file" name="cs_userfile">*
	 </td>
	</tr>
	<tr class="attributes-even">
	 <td class="dataTableContent"><?php echo TABLE_HEADING_CS_ACTIVE; ?></td>
	 <td class="dataTableContent"><select name="active">
		<option value="<?php echo ACC_PLEASE_SELECT; ?>"><?php echo CS_PLEASE_SELECT; ?></option>
		<option <?php if(($show_values) && ($arrdetail['active'] == CS_YES)) echo 'SELECTED'; ?> value="<?php echo CS_YES; ?>"><?php echo CS_YES; ?></option>
		<option <?php if(($show_values) && ($arrdetail['active'] == CS_NO)) echo 'SELECTED'; ?> value="<?php echo CS_NO; ?>"><?php echo CS_NO; ?></option>
	   </select>*
	 </td>
	</tr>
	<tr class="attributes-odd">
	 <td valign="top" class="dataTableContent"><?php echo TABLE_HEADING_CS_DESCRIPTION; ?></td>
	 <td class="dataTableContent"><textarea name="description"><?php if($show_values) echo $arrdetail['description']; ?></textarea></td>
	</tr>
	<tr class="attributes-odd">
	 <td class="dataTableContent"><?php echo TABLE_HEADING_CS_PAGES; ?></td>
	 <td class="dataTableContent"><input type="textarea" name="pages" value="<?php if($show_values) echo $arrdetail['pages']; ?>"/>*</td>
	</tr>
	<tr class="attributes-even">
	 <td class="dataTableContent"><?php echo TABLE_HEADING_CS_POSITION; ?></td>
	 <td class="dataTableContent"><select name="position">
		<option value="<?php echo CS_PLEASE_SELECT; ?>"><?php echo CS_PLEASE_SELECT; ?></option>
		<?php
		$cs_all_pos = getAllPos();
		while ($cs_pos = tep_db_fetch_array($cs_all_pos)) {
		 echo '<br>name= ' . $cs_pos['pos_name'];
		?>
		<option <?php if(($show_values) && ($cs_pos['pos_name'] == $arrdetail['position'])) echo 'SELECTED'; ?> value="<?php echo $cs_pos['pos_name']; ?>"><?php echo $cs_pos['pos_name']; ?></option>

	   <?php } ?>
	   </select>*
	 </td>
	</tr>
	<tr class="attributes-odd">
	 <td class="dataTableContent"><?php echo CS_PL_WIDTH; ?></td>
	 <td class="dataTableContent">
	  <input type="text" maxlength="4" size="4" name="pl_width" value="<?php if(isset($arrdetail['pl_width'])){echo $arrdetail['pl_width'];}else{echo '150';} ?>"/>*
	 </td>
	</tr>
	<tr class="attributes-even">
	 <td class="dataTableContent"><?php echo CS_PL_HEIGHT; ?></td>
	 <td class="dataTableContent">
	  <input type="text" maxlength="4" size="4" name="pl_height" value="<?php if(isset($arrdetail['pl_height'])){echo $arrdetail['pl_height'];}else{echo '150';} ?>"/>*	  
	  </td>
	</tr>
	<tr>
	 <td><a href="<?php echo FILENAME_CS_AV; ?>"><?php echo tep_image_button('button_cancel.gif', '', ''); ?></a></td>
	 <td align="right"><?php echo tep_image_submit('button_save.gif', IMAGE_SAVE); ?></td>
	</tr>
   </table>
  </form>
  </td>
<?php if((isset($arrdetail['cs_name']))&&($arrdetail['filename'] != '')) { ?>
<td width="50%" align="center">
<table>
 <tr>
 <td><?php echo CS_PREV . $arrdetail['cs_name']; ?>
 </td>
 </tr>
 <tr>
 <td><?php echo showClip($arrdetail['filename'],$arrdetail['pl_width'],$arrdetail['pl_height']); ?>
 </td>
 </tr>
</table>  
</td>
<?php }  ?>  
  </tr>
  </table>
  </td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<?php } if(($arr_all_pos != 0) && ($arr_all_pos !='')) { ?>
<tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
 <tr>
  <td align="center">
<table align="center" border="1" rules="none" frame="box">
 <tr class="dataTableHeadingRow">
  <td class="dataTableHeadingContent" colspan="2" align="center"><?php echo CS_POS_MAN; ?>
  </td>
 </tr>
 <tr>
  <td align="center">
<form name="delete_pos" action="<?php echo tep_href_link(FILENAME_CS_AV, 'action=del_pos', 'NONSSL'); ?>" method="post">
 <table align="center" border="1" rules="none" frame="box">
  <tr class="dataTableHeadingRow">
   <td class="dataTableHeadingContent" align="center" colspan="5"><?php echo CS_CUR_POS; ?></td>
  </tr>
  <tr class="dataTableHeadingRow">
   <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CS_POSITION; ?></td>
   <td class="dataTableHeadingContent" align="center"><img src='images/icons/delete.gif'/></td>
  </tr>
<?php
$chbx_counter = 0;
$rows = 0;
while($pos_details = tep_db_fetch_array($arr_all_pos)){
$rows++;
?>
  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
   <td class="dataTableContent"><?php echo $pos_details['pos_name']; ?></td>
   <td class="dataTableContent"><?php echo '<input type="checkbox" name="check' . $chbx_counter . '" value="' . $pos_details['pos_name'] . '" />';?></td>
  </tr>
<?php $chbx_counter++; } ?>
  <tr>
   <td colspan="5">
   <input type="hidden" name="chk_count" value="<?php echo $rows; ?>">
   <?php echo tep_image_submit('cs_button_delete.gif', IMAGE_DELETE); ?>

   </td>
  </tr>
 </table>
</form>
  </td>  
  <td align="center" valign="top">
<table>
 <tr>
  <td valign="top">
<form action="<?php echo tep_href_link(FILENAME_CS_AV, 'action=new_pos', 'NONSSL'); ?>" method="post">
 <table valign="top" align="center" border="0" rules="none" frame="box">
  <tr class="dataTableHeadingRow">
   <td valign="top" class="dataTableHeadingContent" colspan="2" align="center"><?php echo CS_NEW_POS; ?></td>
  </tr>
  <tr>
   <td class="smallText"><?php echo CS_NEW_POS_NAME; ?>
   </td>
   <td><input type="text" name="pos_name" size="20" maxlength="20"/>
   </td>
  </tr>
  <tr>
   <td align="right" colspan="2">
   <?php echo tep_image_submit('cs_button_gen_c.gif', IMAGE_GEN_C); ?></td>
  </tr>
  <tr></tr>
 </table>
</form>
</td>
</tr>
<?php if($poscode!='') { ?>
<tr>
<td><?php echo CS_POS_CODE; ?>
</td>
</tr>
<tr>
<td align="center"><textarea cols="50" rows="1"><?php echo $poscode; ?></textarea>
</td>
</tr>
  <?php } ?>
</table>  
  </td>
 </tr>
 </table>
 </td>
 </tr>
<?php } ?>
</table>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...