1   <?php
  2   /**
  3   * @version      $Id: files.php 12303 2009-08-17 01:54:03Z dmitrya $
  4   * @package      In-Commerce
  5   * @copyright    Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
  6   * @license      Commercial License
  7   * This software is protected by copyright law and international treaties.
  8   * Unauthorized reproduction or unlicensed usage of the code of this program,
  9   * or any portion of it may result in severe civil and criminal penalties,
  10   * and will be prosecuted to the maximum extent possible under the law
  11   * See http://www.in-portal.net/license/commercial/ for copyright notices and details.
  12   */
  13  
  14           defined('FULL_PATH') or die('restricted access!');
  15  
  16           class FilesItem extends kDBItem  {
  17  
  18                   function Delete($id)
  19                   {
  20                           $this->Load($id);
  21                           $upload_dir = $this->Fields['FilePath']['upload_dir'];
  22                           $file_path = FULL_PATH.$upload_dir.$this->GetDBField('FilePath');
  23                           if(file_exists($file_path))
  24                           {
  25                                   unlink($file_path);
  26                           }
  27                           return parent::Delete($id);
  28                   }
  29           }