本文整理汇总了PHP中FileManager::buildDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::buildDatabase方法的具体用法?PHP FileManager::buildDatabase怎么用?PHP FileManager::buildDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::buildDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
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: foreach
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: array
$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();