protected function unlink($file) { $file = realpath($file); if ($this->basedir == $file || strlen($this->basedir) >= strlen($file)) { return; } $ftp = new File_FTP($this->registry); $file_to_delete = $this->getFTPPath($ftp->public_html, $file); if (is_dir($file)) { $file_to_delete .= '/'; } try { if ($this->checkFile($file)) { $ftp->rm($file_to_delete, true); } } catch (Exception $e) { } }
<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if ($this->authorize()) { $menuBar = array(); if ($this->registry->params['comfirm'] == 'delete') { // delete image file first. $login = $this->registry->admin_config->get('FTP'); $row = $this->getResult('image', $ushop->db_name . 'products', null, array('where' => 'product_id=' . $this->registry->params['id'])); $di = true; // set delete flag. if ($row) { $ftp = new File_FTP($this->registry); if ($ftp) { $delete = $ftp->rm($login['public_html'] . '/components/ushop/images/products/' . $row[0]->image); if (!$delete) { $di = false; } $ftp->disconnect(); } else { $di = false; } } else { $di = false; } $res = $this->remove($ushop->db_name . 'products', 'product_id=' . $this->registry->params['id']); if ($res) { $params['TYPE'] = 'pass'; $params['MESSAGE'] = '<h2>Product was successfully deleted.</h2>'; } else {
protected function unlink($file) { $file = realpath($file); if ($this->basedir == $file || strlen($this->basedir) >= strlen($file)) { return; } $ftp = new File_FTP($this->registry); $file_to_delete = $this->getFTPPath($ftp->public_html, $file); $dir = false; if (is_dir($file)) { $file_to_delete .= '/'; $dir = true; } try { if ($this->checkFile($file)) { $ftp->rm($file_to_delete, $dir ? true : false); } } catch (FTPException $e) { echo $e->getMessage(); } }