function delete_before($id) { $arc = new archive(); $info = $arc->getrow($id); $attachment = new attachment(); $res = $attachment->getrows(array("aid"=>$id)); if(is_array($res) && !empty($res)){ foreach($res as $v){ @unlink($v['path']); } } if(category::getarcishtml($info)) { $path=ROOT.preg_replace("%".THIS_URL."[\\/]%",'',archive::url($info)); if(file_exists($path)) unlink($path); } }