return @file_get_contents($localPath); } } } ExceptionCatcherJSON::register(); $oResponse = new Response(); $oFtp = new FileManager(array('hostname' => '', 'username' => '', 'password' => '')); if (!$oFtp->connect()) { throw new Exception("Cannot connect to the FTP server"); } if (Request::getFile() && ($dest = Request::getPost('destination'))) { $errors = array(); foreach (Request::getFile() as $file) { $filePath = $file['tmp_name']; $destPath = $dest . '/' . $file['name']; $result = $oFtp->upload($filePath, $destPath); if (!$result) { $errors[] = $file['name']; } } if ($errors) { throw new Exception("Unknown error uploading: \n\n" . implode(", \n", $errors)); } $oResponse->setData($result); $oResponse->flushJson(); } if (Request::getApiParam('mode') === 'list') { $list = $oFtp->listFilesRaw(Request::getApiParam('path')); $list = is_array($list) ? $list : array(); $list = array_map(function ($item) { $date = new \DateTime('now');
* CubeCart is a registered trade mark of CubeCart Limited * Copyright CubeCart Limited 2015. All rights reserved. * UK Private Limited Company No. 5323904 * ======================================== * Web: http://www.cubecart.com * Email: sales@cubecart.com * License: GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html */ if (!defined('CC_INI_SET')) { die('Access Denied'); } Admin::getInstance()->permissions('settings', CC_PERM_READ, true); global $lang; if (isset($_POST['gc']) && is_array($_POST['gc']) && Admin::getInstance()->permissions('settings', CC_PERM_EDIT)) { $filemanager = new FileManager(FileManager::FM_FILETYPE_IMG); if (($uploaded = $filemanager->upload()) !== false) { foreach ($uploaded as $file_id) { $_POST['image'][(int) $file_id] = true; } } if (isset($_POST['image']) && is_array($_POST['image'])) { $gc = $GLOBALS['config']->get('gift_certs'); foreach ($_POST['image'] as $image_id => $enabled) { if ($enabled == 0) { if ($image_id == $gc['image']) { $_POST['gc']['image'] = ''; } continue; } $_POST['gc']['image'] = (int) $image_id; break;
} } else { $mode = FileManager::FM_FILETYPE_IMG; } $subdir = isset($_GET['subdir']) ? urldecode($_GET['subdir']) : ''; $fm = new FileManager($mode, $subdir); if (isset($_GET['rebuild']) && Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT)) { if ($fm->buildDatabase()) { $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_list_update']); } else { # $GLOBALS['main']->setACPWarning($lang['filemanager']['error_list_update']); } httpredir(currentPage(array('rebuild'))); } if (Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT) && !empty($_FILES)) { if ($fm->upload()) { if (count($_FILES) > 1) { $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_files_upload']); } else { $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_upload']); } } else { $GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_upload']); } httpredir(currentPage()); } if (Admin::getInstance()->permissions('filemanager', CC_PERM_DELETE) && isset($_GET['delete'])) { if ($fm->delete($_GET['delete'])) { $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_delete']); } else { $GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_delete']);
if (!defined('CC_INI_SET')) { die('Access Denied'); } Admin::getInstance()->permissions('categories', CC_PERM_READ, true); global $lang; ########################################### ## Update/Insert a category if (isset($_POST['cat']) && is_array($_POST['cat']) && Admin::getInstance()->permissions('categories', CC_PERM_EDIT)) { foreach ($GLOBALS['hooks']->load('admin.category.save.pre_process') as $hook) { include $hook; } $redirect = true; $keys_remove = null; $keys_add = null; $filemanager = new FileManager(FileManager::FM_FILETYPE_IMG); if (($uploaded = $filemanager->upload()) !== false && is_array($uploaded)) { foreach ($uploaded as $file_id) { $_POST['image'][(int) $file_id] = true; } } foreach ($_POST['cat'] as $key => $value) { if (!in_array($key, array('cat_name'))) { continue; } $_POST['cat'][$key] = html_entity_decode($value); } $_POST['cat']['hide'] = (int) $_POST['cat']['visible'] && (int) $_POST['cat']['status'] ? 0 : 1; $_POST['cat']['cat_desc'] = $GLOBALS['RAW']['POST']['cat']['cat_desc']; if (is_numeric($_POST['cat']['cat_id'])) { $cat_id = $_POST['cat']['cat_id']; $old_image = $GLOBALS['db']->select('CubeCart_category', array('cat_image'), array('cat_id' => $_POST['cat']['cat_id']));
return @file_get_contents($localPath); } } } ExceptionCatcherJSON::register(); $oResponse = new Response(); $oFtp = new FileManager(array('hostname' => '', 'username' => '', 'password' => '')); if (!$oFtp->connect()) { throw new Exception("Cannot connect to the FTP server"); } if (Request::getFile() && ($dest = Request::getPost('destination'))) { $errors = array(); foreach (Request::getFile() as $file) { $filePath = $file['tmp_name']; $destPath = $dest . '/' . $file['name']; $result = $oFtp->upload($filePath, $destPath); if (!$result) { $errors[] = $file['name']; } } if ($errors) { throw new Exception("Unknown error uploading: \n\n" . implode(", \n", $errors)); } $oResponse->setData($result); $oResponse->flushJson(); } if (Request::getApiParam('action') === 'list') { $list = $oFtp->listFilesRaw(Request::getApiParam('path')); $list = is_array($list) ? $list : array(); $list = array_map(function ($item) { $date = new \DateTime('now');