예제 #1
0
        case 'digital':
            $mode = FileManager::FM_FILETYPE_DL;
            break;
        case 'fck':
            $GLOBALS['main']->hideNavigation(true);
            $select_button = true;
        default:
            $mode = FileManager::FM_FILETYPE_IMG;
    }
} 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']);
예제 #2
0
파일: 5.0.0b1.php 프로젝트: Dirty-Butter/v6
    foreach ($category_files as $file) {
        $db->misc("UPDATE `" . $glob['dbprefix'] . "CubeCart_category` SET `cat_image` = '" . preg_replace($regex_slash_keep, '_', $file['cat_image']) . "' WHERE `cat_id` = '" . $file['cat_id'] . "'");
    }
}
$filemanager_files = $db->select('CubeCart_filemanager', array('filepath', 'filename', 'file_id'));
if ($filemanager_files) {
    foreach ($filemanager_files as $file) {
        $new_file_path = preg_replace($regex_slash_keep, '_', $file['filepath']);
        $new_file_path = empty($new_file_path) ? 'NULL' : "'" . $new_file_path . "'";
        $db->misc("UPDATE `" . $glob['dbprefix'] . "CubeCart_filemanager` SET `filepath` = " . $new_file_path . ", `filename` = '" . preg_replace($regex_slash_remove, '_', $file['filename']) . "' WHERE `file_id` = '" . $file['file_id'] . "'");
    }
}
unset($product_files, $category_files, $filemanager_files);
## Update FileManager table first
$fm = new FileManager();
$fm->buildDatabase();
$config_string = $db->select('CubeCart_config', array('array'), array('name' => 'config'));
$v4config = json_decode(base64_decode($config_string[0]['array']), true);
foreach (glob('../images/logos/*') as $file) {
    if (!preg_match('/[.][a-z]{3}/', $file, $match)) {
        $mime = $fm->getMimeType($file);
        $size = getimagesize($file);
        if (preg_match('/(png|jpg|jpeg|gif)/', $mime, $match)) {
            $match[0] = $match[0] == 'jpeg' ? 'jpg' : $match[0];
            $new_name = $file . '.' . $match[0];
            chmod($file, chmod_writable());
            rename($file, $new_name);
            chmod($new_name, chmod_writable());
        }
        $file_name = preg_replace('/..\\/images\\/logos\\//', '', $file);
        $new_file_name = preg_replace('/..\\/images\\/logos\\//', '', $new_name);
예제 #3
0
     $file_array = array();
     if (($images = $GLOBALS['db']->misc('SELECT I.file_id, I.main_img, F.filepath, F.filename FROM `' . $GLOBALS['config']->get('config', 'dbprefix') . 'CubeCart_image_index` AS `I` INNER JOIN `' . $GLOBALS['config']->get('config', 'dbprefix') . 'CubeCart_filemanager` as `F` ON I.file_id = F.file_id WHERE I.product_id = ' . (int) $_GET['product_id'])) !== false) {
         $update_filemanager = false;
         foreach ($images as $image) {
             if ($image['file_id'] > 0 && !file_exists(CC_ROOT_DIR . '/images/source/' . $image['filepath'] . $image['filename'])) {
                 $GLOBALS['db']->delete('CubeCart_image_index', array('file_id' => $image['file_id']));
                 $update_filemanager = true;
                 continue;
             }
             $file_array[$image['file_id']] = $image['file_id'];
             if ($image['main_img'] == '1') {
                 $default = $image['file_id'];
             }
         }
         if ($update_filemanager) {
             $filemanager->buildDatabase();
         }
     } else {
         $default = 0;
     }
     if (!empty($result[0]['digital'])) {
         if (empty($result[0]['digital_path'])) {
             $file_array[$result[0]['digital']] = $result[0]['digital'];
         }
     }
 } else {
     // Breadcrumb
     $GLOBALS['gui']->addBreadcrumb($lang['catalogue']['product_add'], $_GET);
     $result[0] = array('featured' => 1, 'tax_inclusive' => 0, 'use_stock_level' => 1);
     $result[0] = array_merge($result[0], $_POST);
     $file_array = array();