include_once($path_to_root . "/inventory/includes/db/items_transfer_db.inc");
include_once($path_to_root . "/inventory/includes/db/items_units_db.inc");
+function item_img_name($stock_id)
+{
+ return strtr($stock_id, "><\\/:|*?", '________');
+}
+
?>
\ No newline at end of file
if (isset($_GET['stock_id']))
{
- $_POST['stock_id'] = $stock_id = strtoupper($_GET['stock_id']);
+ $_POST['stock_id'] = $stock_id = $_GET['stock_id'];
}
else if (isset($_POST['stock_id']))
{
- $stock_id = strtoupper($_POST['stock_id']);
+ $stock_id = $_POST['stock_id'];
}
if (list_updated('stock_id')) {
{
mkdir($filename);
}
- $filename .= "/$stock_id.jpg";
+ $filename .= "/".item_img_name($stock_id).".jpg";
//But check for the worst
if (strtoupper(substr(trim($_FILES['pic']['name']), strlen($_FILES['pic']['name']) - 3)) != 'JPG')
$stock_id = $_POST['NewStockID'];
delete_item($stock_id);
- $filename = $comp_path . "/$user_comp/images/$stock_id.jpg";
+ $filename = $comp_path . "/$user_comp/images/".item_img_name($stock_id).".jpg";
if (file_exists($filename))
unlink($filename);
display_notification(_("Selected item has been deleted."));
label_row(_("Image File (.jpg)") . ":", "<input type='file' id='pic' name='pic'>");
// Add Image upload for New Item - by Joe
$stock_img_link = "";
-if (isset($_POST['NewStockID']) && file_exists("$comp_path/$user_comp/images/".$_POST['NewStockID'].".jpg"))
+if (isset($_POST['NewStockID']) && file_exists("$comp_path/$user_comp/images/"
+ .item_img_name($_POST['NewStockID']).".jpg"))
{
// 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D.
$stock_img_link .= "<img id='item_img' alt = '[".$_POST['NewStockID'].".jpg".
- "]' src='$comp_path/$user_comp/images/".$_POST['NewStockID'].".jpg?nocache=".rand()."'".
+ "]' src='$comp_path/$user_comp/images/".item_img_name($_POST['NewStockID']).".jpg?nocache=".rand()."'".
" width='$pic_width' height='$pic_height' border='0'>";
}
else
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/sales/includes/db/sales_types_db.inc");
-include_once($path_to_root . "/inventory/includes/db/items_category_db.inc");
+include_once($path_to_root . "/inventory/includes/db/inventory_db.inc");
//----------------------------------------------------------------------------------------------------
}
if ($pictures)
{
- $image = $comp_path . '/'. $user_comp . "/images/" . $myrow['stock_id'] . ".jpg";
+ $image = $comp_path . '/'. $user_comp . "/images/"
+ . item_img_name($myrow['stock_id']) . ".jpg";
if (file_exists($image))
{
$rep->NewLine();
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
-include_once($path_to_root . "/inventory/includes/db/items_category_db.inc");
+include_once($path_to_root . "/inventory/includes/db/inventory_db.inc");
//----------------------------------------------------------------------------------------------------
}
if ($pictures)
{
- $image = $comp_path .'/'. $user_comp . '/images/' . $trans['stock_id'] . '.jpg';
+ $image = $comp_path .'/'. $user_comp . '/images/'
+ . item_img_name($trans['stock_id']) . '.jpg';
if (file_exists($image))
{
$rep->NewLine();