本文整理汇总了PHP中fn_copy函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_copy函数的具体用法?PHP fn_copy怎么用?PHP fn_copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_copy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fn_settings_actions_addons_webmail
function fn_settings_actions_addons_webmail(&$new_value, $old_value)
{
if ($new_value == 'A') {
// Copy data directory to "var"
$dir_data = DIR_ROOT . '/var/webmail';
if (fn_copy(DIR_ADDONS . 'webmail/lib/webmail/data', $dir_data) == false) {
$msg = fn_get_lang_var('text_cannot_write_directory');
fn_set_notification('E', fn_get_lang_var('error'), str_replace('[directory]', $dir_data, $msg));
$new_value = 'D';
return false;
}
$config = Registry::get('config');
$_settings = $dir_data . '/settings/settings.xml';
// 1 step, generate config file
$xml = simplexml_load_file($_settings);
$xml->Common->DBLogin = $config['db_user'];
$xml->Common->DBPassword = $config['db_password'];
$xml->Common->DBName = $config['db_name'];
$xml->Common->DBHost = $config['db_host'];
if (fn_put_contents($_settings, $xml->asXML()) == false) {
$msg = fn_get_lang_var('cannot_write_file');
fn_set_notification('E', fn_get_lang_var('error'), str_replace('[file]', $_settings, $msg));
$new_value = 'D';
return false;
}
include DIR_ADDONS . 'webmail/lib/webmail/web/class_settings.php';
include DIR_ADDONS . 'webmail/lib/webmail/web/class_dbstorage.php';
// Init mailbee core
$null = null;
$settings =& Settings::CreateInstance();
$dbStorage =& DbStorageCreator::CreateDatabaseStorage($null);
$dbStorage->Connect();
$dbStorage->CreateTables($settings->DbPrefix);
}
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:35,代码来源:actions.post.php
示例2: process
function process($tmp_filename, $content_type)
{
$dest_filename = OUTPUT_FILE_DIRECTORY . $this->filename_escape($this->get_filename()) . "." . $content_type->default_extension;
fn_copy($tmp_filename, $dest_filename);
$text = $this->_link_text;
$text = preg_replace('/%link%/', 'file://' . $dest_filename, $text);
$text = preg_replace('/%name%/', $this->get_filename(), $text);
print $text;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:9,代码来源:destination.file.class.php
示例3: save
/**
* Saves uploaded pattern to theme
* @param string $style_id style ID
* @param array $style style
* @param array $uploaded_data uploaded data
* @return array modified style
*/
public static function save($style_id, $style, $uploaded_data)
{
$style_id = fn_basename($style_id);
$patterns = self::getPath($style_id);
if (!is_dir($patterns)) {
fn_mkdir($patterns);
}
foreach ($uploaded_data as $var => $file) {
$fname = $var . '.' . fn_get_file_ext($file['name']);
if (fn_copy($file['path'], $patterns . '/' . $fname)) {
$style['data'][$var] = "url('" . self::getRelPath($style_id) . '/' . $fname . '?' . TIME . "')";
}
}
return $style;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:22,代码来源:Patterns.php
示例4: downloadPackage
public function downloadPackage($schema, $package_path)
{
if (!empty($schema['download_key'])) {
$upgrade_path = $this->settings['packages_server'] . $this->settings['addon'] . '/' . $schema['file'];
$addon_upgrades_dir = Registry::get('config.dir.addons') . $this->settings['addon'] . '/upgrades/';
$addon_upgrades_path = $addon_upgrades_dir . $schema['file'];
if (!file_exists($addon_upgrades_path)) {
fn_mkdir($addon_upgrades_dir);
$addon_upgrade_data = fn_get_contents($upgrade_path);
fn_put_contents($addon_upgrades_path, $addon_upgrade_data);
}
$result = fn_copy($addon_upgrades_path, $package_path);
if ($result) {
fn_rm($addon_upgrades_path);
}
//cleanup
$message = $result ? '' : __('failed') . '-' . $addon_upgrades_path;
return array($result, $message);
} else {
return array(false, __($schema['error_message']));
}
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:22,代码来源:Connector.php
示例5: foreach
if ($mode == 'm_delete') {
if (!empty($_REQUEST['backup_files'])) {
foreach ($_REQUEST['backup_files'] as $file) {
@unlink(Registry::get('config.dir.backups') . fn_basename($file));
}
}
}
if ($mode == 'upload') {
$dump = fn_filter_uploaded_data('dump', array('sql', 'tgz', 'zip'));
if (!empty($dump)) {
$dump = array_shift($dump);
// Check if backups folder exists. If not - create it
if (!is_dir(Registry::get('config.dir.backups'))) {
fn_mkdir(Registry::get('config.dir.backups'));
}
if (fn_copy($dump['path'], Registry::get('config.dir.backups') . $dump['name'])) {
fn_set_notification('N', __('notice'), __('done'));
} else {
fn_set_notification('E', __('error'), __('cant_create_backup_file'));
}
} else {
fn_set_notification('E', __('error'), __('cant_upload_file'));
}
}
if ($mode == 'optimize') {
// Log database optimization
fn_log_event('database', 'optimize');
$all_tables = db_get_fields("SHOW TABLES");
fn_set_progress('parts', sizeof($all_tables));
foreach ($all_tables as $table) {
fn_set_progress('echo', __('optimizing_table') . " <b>{$table}</b>...<br />");
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:datakeeper.php
示例6: _getUploadedLogos
private static function _getUploadedLogos()
{
$logos = fn_filter_uploaded_data('tw_settings');
$logo_names = array('logo', 'favicon');
$options = array();
foreach ($logo_names as $logo_name) {
if ($logos and !empty($logos[$logo_name])) {
$logo = $logos[$logo_name];
$filename = fn_twg_get_images_path() . $logo['name'];
// On some hosts files copy buggy
touch($filename);
if (!fn_copy($logo['path'], $filename)) {
$_text = __('text_cannot_create_file');
$text = str_replace('[file]', $filename, $_text);
fn_set_notification('E', __('error'), $text);
} else {
$options[$logo_name . '_url'] = $filename;
}
@unlink($logo['path']);
}
}
return $options;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:23,代码来源:TwigmoSettings.php
示例7: fn_get_contents
if (fn_te_check_path($fname) && !in_array(fn_strtolower(fn_get_file_ext($fname)), Registry::get('config.forbidden_file_extensions'))) {
Tygh::$app['ajax']->assign('content', fn_get_contents($fname));
} else {
fn_set_notification('E', __('error'), __('you_have_no_permissions'));
}
exit;
} elseif ($mode == 'restore') {
$copied = false;
$file_path = fn_te_normalize_path($_REQUEST, $root_dir);
if (fn_te_check_path($file_path)) {
$repo_path = str_replace($root_dir, fn_te_get_root('repo'), $file_path);
if (!file_exists($repo_path) && fn_get_theme_path('[theme]') != Registry::get('config.base_theme') && is_dir(fn_get_theme_path('[repo]/[theme]'))) {
$repo_path = preg_replace("/\\/themes_repository\\/(\\w+)\\//", "/themes_repository/" . Registry::get('config.base_theme') . "/", $repo_path);
}
$object_base = is_file($repo_path) ? 'file' : (is_dir($repo_path) ? 'directory' : '');
if (!empty($object_base) && fn_copy($repo_path, $file_path)) {
fn_set_notification('N', __('notice'), __("text_{$object_base}_restored", array("[{$object_base}]" => fn_basename($file_path))));
Tygh::$app['ajax']->assign('content', fn_get_contents($file_path));
$copied = true;
}
}
if (!$copied) {
$object_base = empty($object_base) ? 'file' : $object_base;
fn_set_notification('E', __('error'), __("text_cannot_restore_{$object_base}", array("[{$object_base}]" => fn_basename($file_path))));
}
return array(CONTROLLER_STATUS_REDIRECT, 'templates.init_view?dir=' . $_REQUEST['file_path'] . '/' . $_REQUEST['file']);
}
/**
* Checks if working path is inside root directory
* @param string $path working path
* @return boolean true of success, false - otherwise
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:templates.php
示例8: fn_addons_move_and_install
/**
* Move addon pack from temporarily folder to specified place and install it if possible
*
* @param string $from Source path
* @param string $to Destination path
* @return bool true if installed, false otherwise
*/
function fn_addons_move_and_install($from, $to)
{
if (defined('AJAX_REQUEST')) {
Registry::get('ajax')->assign('non_ajax_notifications', true);
}
$struct = fn_get_dir_contents($from, false, true, '', '', true);
$addon_name = '';
foreach ($struct as $file) {
if (preg_match('/app.+?addons[^a-zA-Z0-9_]+([a-zA-Z0-9_-]+).+?addon.xml$/i', $file, $matches)) {
if (!empty($matches[1])) {
$addon_name = $matches[1];
break;
}
}
}
$relative_addon_path = str_replace(Registry::get('config.dir.root') . '/', '', Registry::get('config.dir.addons'));
if (!file_exists($from . $relative_addon_path . $addon_name . '/addon.xml')) {
fn_set_notification('E', __('error'), __('broken_addon_pack'));
return false;
}
fn_copy($from, $to);
fn_install_addon($addon_name);
fn_rm($from);
return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:32,代码来源:fn.addons.php
示例9: fn_get_theme_path
if ($ext == 'tpl') {
$theme_path = fn_get_theme_path('[themes]/[theme]/templates/', 'C');
if (fn_put_contents($_REQUEST['file'], $_REQUEST['content'], $theme_path)) {
fn_set_notification('N', __('notice'), __('text_file_saved', array('[file]' => fn_basename($_REQUEST['file']))));
}
}
return array(CONTROLLER_STATUS_REDIRECT, $_REQUEST['current_url']);
}
if ($mode == 'restore_template') {
$copied = false;
$full_path = fn_get_theme_path('[themes]/[theme]', 'C') . '/templates/' . $_REQUEST['file'];
if (fn_check_path($full_path)) {
$c_name = fn_normalize_path($full_path);
$r_name = fn_normalize_path(Registry::get('config.dir.themes_repository') . Registry::get('config.base_theme') . '/templates/' . $_REQUEST['file']);
if (is_file($r_name)) {
$copied = fn_copy($r_name, $c_name);
}
if ($copied) {
fn_set_notification('N', __('notice'), __('text_file_restored', array('[file]' => fn_basename($_REQUEST['file']))));
} else {
fn_set_notification('E', __('error'), __('text_cannot_restore_file', array('[file]' => fn_basename($_REQUEST['file']))));
}
if ($copied) {
if (defined('AJAX_REQUEST')) {
Registry::get('ajax')->assign('force_redirection', fn_url($_REQUEST['current_url']));
Registry::get('ajax')->assign('non_ajax_notifications', true);
}
return array(CONTROLLER_STATUS_OK, $_REQUEST['current_url']);
}
}
exit;
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:design_mode.php
示例10: fn_update_payment
/**
* Create/Update payments data
*
* @param array $payment_data
* @param int $payment_id
* @param string $lang_code 2-letter language code
* @return int Payment id
*/
function fn_update_payment($payment_data, $payment_id, $lang_code = DESCR_SL)
{
$certificate_file = fn_filter_uploaded_data('payment_certificate');
$certificates_dir = Registry::get('config.dir.certificates');
fn_set_hook('update_payment_pre', $payment_data, $payment_id, $lang_code, $certificate_file, $certificates_dir);
/**
* Create/update the certificate file
* only for an existing payment method.
*
* Non-existing payment method will be created first,
* then will be updated. (fn_update_payment calling at line 450).
*/
if ($payment_id) {
if ($certificate_file) {
$file = reset($certificate_file);
$filename = $payment_id . '/' . $file['name'];
fn_mkdir($certificates_dir . $payment_id);
fn_copy($file['path'], $certificates_dir . $filename);
$payment_data['processor_params']['certificate_filename'] = $filename;
}
$old_params = fn_get_processor_data($payment_id);
if (empty($payment_data['processor_params']['certificate_filename']) && isset($old_params['processor_params']['certificate_filename'])) {
$payment_data['processor_params']['certificate_filename'] = $old_params['processor_params']['certificate_filename'];
}
if (!empty($payment_data['processor_params']['certificate_filename'])) {
if (!empty($old_params['processor_params']['certificate_filename']) && $payment_data['processor_params']['certificate_filename'] != $old_params['processor_params']['certificate_filename']) {
fn_rm($certificates_dir . $old_params['processor_params']['certificate_filename']);
}
if (!file_exists($certificates_dir . $payment_data['processor_params']['certificate_filename'])) {
$payment_data['processor_params']['certificate_filename'] = '';
}
}
}
if (!empty($payment_data['processor_id'])) {
$payment_data['template'] = db_get_field("SELECT processor_template FROM ?:payment_processors WHERE processor_id = ?i", $payment_data['processor_id']);
}
$payment_data['localization'] = !empty($payment_data['localization']) ? fn_implode_localizations($payment_data['localization']) : '';
$payment_data['usergroup_ids'] = empty($payment_data['usergroup_ids']) ? USERGROUP_ALL : (is_array($payment_data['usergroup_ids']) ? implode(',', $payment_data['usergroup_ids']) : $payment_data['usergroup_ids']);
$payment_data['tax_ids'] = !empty($payment_data['tax_ids']) ? fn_create_set($payment_data['tax_ids']) : '';
// Update payment processor settings
$processor_params = array();
if (!empty($payment_data['processor_params'])) {
$processor_params = $payment_data['processor_params'];
$payment_data['processor_params'] = serialize($payment_data['processor_params']);
}
if (!empty($payment_id)) {
$arow = db_query("UPDATE ?:payments SET ?u WHERE payment_id = ?i", $payment_data, $payment_id);
db_query("UPDATE ?:payment_descriptions SET ?u WHERE payment_id = ?i AND lang_code = ?s", $payment_data, $payment_id, $lang_code);
if ($arow === false) {
fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('payment'))), '', '404');
$payment_id = false;
}
} else {
$payment_data['payment_id'] = $payment_id = db_query("INSERT INTO ?:payments ?e", $payment_data);
foreach (fn_get_translation_languages() as $payment_data['lang_code'] => $_v) {
db_query("INSERT INTO ?:payment_descriptions ?e", $payment_data);
}
/**
* Update the certificate
*/
if ($certificate_file && $payment_id) {
unset($payment_data['lang_code']);
$payment_data['processor_params'] = $processor_params;
fn_update_payment($payment_data, $payment_id, $lang_code);
}
}
fn_attach_image_pairs('payment_image', 'payment', $payment_id, $lang_code);
fn_set_hook('update_payment_post', $payment_data, $payment_id, $lang_code, $certificate_file, $certificates_dir, $processor_params);
return $payment_id;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:78,代码来源:fn.cart.php
示例11: fn_update_attachments
function fn_update_attachments($attachment_data, $attachment_id, $object_type, $object_id, $type = 'M', $lang_code = CART_LANGUAGE)
{
$object_id = intval($object_id);
if (!fn_mkdir(DIR_ATTACHMENTS)) {
return false;
}
$revision_id = 0;
if (AREA == 'A' && Registry::is_exist('revisions') && !Registry::get('revisions.working')) {
$revisions = Registry::get('revisions');
if (!empty($revisions['objects'][$object_type]) && !empty($revisions['objects'][$object_type]['tables'])) {
$object_data = $revisions['objects'][$object_type];
if ($object_data['attachments']) {
$entry = array($object_data['key'] => $object_id);
list($revision, $revision_id) = fn_revisions_get_last($object_type, $entry, 0, 'attachments');
}
}
}
if ($revision_id) {
$_ = 'rev_';
$revision_condition = db_quote(" AND revision = ?s AND revision_id = ?i", $revision, $revision_id);
} else {
$_ = '';
$revision_condition = '';
}
$directory = DIR_ATTACHMENTS . '/' . $object_type . ($revision_condition ? '_rev' : '') . '/' . $object_id;
if (!fn_mkdir($directory)) {
return false;
}
$uploaded_data = fn_filter_uploaded_data('attachment_files');
$rec = array('usergroup_ids' => empty($attachment_data['usergroup_ids']) ? '' : implode(',', $attachment_data['usergroup_ids']), 'position' => $attachment_data['position']);
db_query("UPDATE ?:{$_}attachment_descriptions SET description = ?s WHERE attachment_id = ?i AND lang_code = ?s ?p", $attachment_data['description'], $attachment_id, $lang_code, $revision_condition);
db_query("UPDATE ?:{$_}attachments SET ?u WHERE attachment_id = ?i AND object_type = ?s AND object_id = ?i AND type = ?s ?p", $rec, $attachment_id, $object_type, $object_id, $type, $revision_condition);
if ($attachment_id && !empty($uploaded_data[$attachment_id]) && $uploaded_data[$attachment_id]['size']) {
$filename = $uploaded_data[$attachment_id]['name'];
$old_filename = db_get_field("SELECT filename FROM ?:{$_}attachments WHERE attachment_id = ?i ?p", $attachment_id, $revision_condition);
if (!$revision_id && $old_filename && is_file($directory . '/' . $old_filename)) {
unlink($directory . '/' . $old_filename);
}
$i = 1;
while (is_file($directory . '/' . $filename)) {
$filename = substr_replace($uploaded_data[$attachment_id]['name'], sprintf('%03d', $i) . '.', strrpos($uploaded_data[$attachment_id]['name'], '.'), 1);
$i++;
}
fn_copy($uploaded_data[$attachment_id]['path'], $directory . '/' . $filename);
if (is_file($directory . '/' . $filename)) {
$filesize = filesize($directory . '/' . $filename);
db_query("UPDATE ?:{$_}attachments SET filename = ?s, filesize = ?i WHERE attachment_id = ?i ?p", $filename, $filesize, $attachment_id, $revision_condition);
}
}
return true;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:51,代码来源:func.php
示例12: processThemesFiles
/**
* Copies theme files from the theme_repository to design folder
*
* @param array $schema UC package schema
* @return array List of processed files
*/
protected function processThemesFiles($schema)
{
if (empty($schema['files'])) {
return array();
}
$repo_files = array();
$repo_path = str_replace($this->config['dir']['root'] . '/', '', $this->config['dir']['themes_repository']);
// Process themes_repository
foreach ($schema['files'] as $file_path => $file_data) {
if (strpos($file_path, $repo_path) !== false) {
$path = str_replace($repo_path, '', $file_path);
$path = explode('/', $path);
$theme_name = array_shift($path);
$repo_files[$theme_name][] = implode('/', $path);
}
}
$themes = fn_get_dir_contents($this->config['dir']['root'] . '/design/themes/');
foreach ($themes as $theme_name) {
$manifest = Themes::factory($theme_name)->getManifest();
$parent_theme = empty($manifest['parent_theme']) ? 'basic' : $manifest['parent_theme'];
if (!empty($repo_files[$parent_theme])) {
foreach ($repo_files[$parent_theme] as $file_path) {
// Check if we need to create folders path before copying
$dir_path = dirname($this->config['dir']['root'] . '/design/themes/' . $theme_name . '/' . $file_path);
fn_mkdir($dir_path);
fn_copy($this->config['dir']['themes_repository'] . $parent_theme . '/' . $file_path, $this->config['dir']['root'] . '/design/themes/' . $theme_name . '/' . $file_path);
}
}
}
return $repo_files;
}
开发者ID:askzap,项目名称:ultimate,代码行数:37,代码来源:App.php
示例13: removeLessFiles
/**
* Remove LESS files
*
* @param string $from The directory the LESS files are removed from
* @param string $backup_dir Backup directory
* @param array $exclude The list of directories to skip while removing
*
* @return boolean Result
*/
protected function removeLessFiles($from, $backup_dir, $exclude = array())
{
$less_files = fn_get_dir_contents($from, false, true, '.less', '', true, $exclude);
foreach ($less_files as $less_file) {
if (!empty($backup_dir)) {
if (!(fn_mkdir(dirname($backup_dir . '/' . $less_file)) && fn_copy($from . '/' . $less_file, $backup_dir . '/' . $less_file))) {
return false;
}
}
fn_rm($from . '/' . $less_file);
}
return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:22,代码来源:Themes.php
示例14: elseif
} elseif ($mode == 'upload') {
if (defined('RESTRICTED_ADMIN') || Registry::get('runtime.company_id')) {
fn_set_notification('E', __('error'), __('access_denied'));
return array(CONTROLLER_STATUS_REDIRECT, 'addons.manage');
}
$addon_pack = fn_filter_uploaded_data('addon_pack', Registry::get('config.allowed_pack_exts'));
if (empty($addon_pack[0])) {
fn_set_notification('E', __('error'), __('text_allowed_to_upload_file_extension', array('[ext]' => implode(',', Registry::get('config.allowed_pack_exts')))));
} else {
// Extract the add-on pack and check the permissions
$extract_path = fn_get_cache_path(false) . 'tmp/addon_pack/';
$addon_pack = $addon_pack[0];
// Re-create source folder
fn_rm($extract_path);
fn_mkdir($extract_path);
fn_copy($addon_pack['path'], $extract_path . $addon_pack['name']);
if (fn_decompress_files($extract_path . $addon_pack['name'], $extract_path)) {
fn_rm($extract_path . $addon_pack['name']);
$struct = fn_get_dir_contents($extract_path, false, true, '', '', true);
$addon_name = '';
$relative_addon_path = str_replace(Registry::get('config.dir.root') . '/', '', Registry::get('config.dir.addons'));
foreach ($struct as $file) {
if (preg_match('#' . $relative_addon_path . '[^a-zA-Z0-9_]*([a-zA-Z0-9_-]+).+?addon.xml$#i', $file, $matches)) {
if (!empty($matches[1])) {
$addon_name = $matches[1];
}
}
}
if (empty($addon_name)) {
fn_set_notification('E', __('error'), __('broken_addon_pack'));
if (defined('AJAX_REQUEST')) {
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:addons.php
示例15: foreach
// cleanup cache
}
$suffix = '?selected_section=restore';
}
if ($mode == 'delete') {
if (!empty($_REQUEST['backup_files'])) {
foreach ($_REQUEST['backup_files'] as $file) {
@unlink(DIR_DATABASE . 'backup/' . $file);
}
}
}
if ($mode == 'upload') {
$sql_dump = fn_filter_uploaded_data('sql_dump');
if (!empty($sql_dump)) {
$sql_dump = array_shift($sql_dump);
fn_copy($sql_dump['path'], DIR_DATABASE . 'backup/' . $sql_dump['name']);
}
}
if ($mode == 'optimize') {
// Log database optimization
fn_log_event('database', 'optimize');
$all_tables = db_get_fields("SHOW TABLES");
fn_start_scroller();
foreach ($all_tables as $table) {
fn_echo(fn_get_lang_var('optimizing_table') . " <b>{$table}</b>...<br />");
db_query("OPTIMIZE TABLE {$table}");
db_query("ANALYZE TABLE {$table}");
$fields = db_get_hash_array("SHOW COLUMNS FROM {$table}", 'Field');
if (!empty($fields['is_global'])) {
// Sort table by is_global field
fn_echo(fn_get_lang_var('sorting_data') . " <b>{$table}</b>...<br />");
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:database.php
示例16: fn_install_theme_files
/**
* Installs theme files
*
* @param string $source_theme source theme name
* @param string $dest_theme destination theme name
* @param boolean $from_repo flag, if set to true, theme files are copied from themes_repository
* @return boolean true if theme was installed, false otherwise
*/
function fn_install_theme_files($source_theme, $dest_theme, $from_repo = true)
{
$path_dest = fn_get_theme_path('[themes]/' . $dest_theme, 'C');
if (!fn_is_theme_installed($dest_theme)) {
if (!fn_mkdir($path_dest)) {
fn_set_notification('E', __('error'), __('text_cannot_create_directory', array('[directory]' => fn_get_rel_dir($path_dest))));
return false;
}
$path_repo_base = '';
if ($from_repo) {
$path_repo = fn_get_theme_path('[repo]/' . $source_theme, 'C');
$manifest = Themes::factory($source_theme)->getRepoManifest();
$parent_theme = isset($manifest['parent_theme']) ? $manifest['parent_theme'] : Registry::get('config.base_theme');
if (!empty($parent_theme) && $source_theme != $parent_theme) {
$path_repo_base = fn_get_theme_path('[repo]/' . $parent_theme, 'C');
}
} else {
$path_repo = fn_get_theme_path('[themes]/' . $source_theme, 'C');
}
fn_set_progress('parts', fn_dirs_count($path_repo_base) + fn_dirs_count($path_repo) + 1);
// FIXME: Backward compatibility. Create manifest.json if theme only has manifest.ini
if (file_exists($path_repo . '/' . THEME_MANIFEST_INI) && !file_exists($path_repo . '/' . THEME_MANIFEST)) {
$content = parse_ini_file($path_repo . '/' . THEME_MANIFEST_INI);
fn_put_contents($path_repo . '/' . THEME_MANIFEST, json_encode($content));
}
if (!empty($path_repo_base)) {
fn_copy($path_repo_base, $path_dest, false);
// Clear layouts and styles data
fn_rm($path_dest . '/styles');
fn_rm($path_dest . '/layouts');
// FIXME: Backward compatibility
fn_rm($path_dest . '/presets');
}
fn_copy($path_repo, $path_dest, false);
}
// Re-install add-ons template files
list($installed_addons) = fn_get_addons(array('type' => 'installed'));
foreach ($installed_addons as $addon) {
fn_install_addon_templates($addon['addon']);
}
return true;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:50,代码来源:fn.common.php
示例17: fn_rm
}
fn_rm(DIR_COMPILED . 'customer', false);
fn_rm(DIR_COMPILED . 'admin', false);
$suffix = '.design_mode';
}
if ($mode == 'update_logos') {
$logos = fn_filter_uploaded_data('logotypes');
$areas = fn_get_manifest_definition();
fn_save_logo_alt($areas);
// Update customer logotype
if (!empty($logos)) {
foreach ($logos as $type => $logo) {
$area = $areas[$type];
$manifest = parse_ini_file(DIR_SKINS . Registry::get('settings.skin_name_' . $area['skin']) . '/' . SKIN_MANIFEST, true);
$filename = DIR_SKINS . Registry::get('settings.skin_name_' . $area['skin']) . '/' . $area['path'] . '/images/' . $logo['name'];
if (fn_copy($logo['path'], $filename)) {
list($w, $h, ) = fn_get_image_size($filename);
$manifest[$area['name']]['filename'] = $logo['name'];
$manifest[$area['name']]['width'] = $w;
$manifest[$area['name']]['height'] = $h;
fn_write_ini_file(DIR_SKINS . Registry::get('settings.skin_name_' . $area['skin']) . '/' . SKIN_MANIFEST, $manifest);
} else {
$text = fn_get_lang_var('text_cannot_create_file');
$text = str_replace('[file]', $filename, $text);
fn_set_notification('E', fn_get_lang_var('error'), $text);
}
@unlink($logo['path']);
}
}
$suffix = '.logos';
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:site_layout.php
示例18: copy
/**
* Copy files inside storage
*
* @param string $src source file/directory
* @param string $dest destination file/directory
* @return boolean true if copied successfully, false - otherwise
*/
public function copy($src, $dest)
{
$dest = $this->prefix($dest);
if (!$this->isExist($src) || !fn_mkdir(dirname($dest))) {
return false;
}
return fn_copy($this->prefix($src), $dest);
}
开发者ID:ambient-lounge,项目名称:site,代码行数:15,代码来源:File.php
示例19: fn_companies_update_logos
function fn_companies_update_logos($company_id, $old_logos)
{
$logotypes = fn_filter_uploaded_data('logotypes');
$areas = fn_companies_get_manifest_definition();
// Update company logotypes
if (!empty($logotypes)) {
$logos = $old_logos;
foreach ($logotypes as $type => $logo) {
$area = $areas[$type];
$short_name = "company/{$company_id}/{$type}_{$logo['name']}";
$filename = DIR_IMAGES . $short_name;
fn_mkdir(dirname($filename));
if (fn_copy($logo['path'], $filename)) {
list($w, $h, ) = fn_get_image_size($filename);
$logos[$area['name']] = array('vendor' => 1, 'filename' => $short_name, 'width' => $w, 'height' => $h);
} else {
$text = fn_get_lang_var('text_cannot_create_file');
$text = str_replace('[file]', $filename, $text);
fn_set_notification('E', fn_get_lang_var('error'), $text);
}
@unlink($logo['path']);
}
$logos = serialize($logos);
db_query("UPDATE ?:companies SET logos = ?s WHERE company_id = ?i", $logos, $company_id);
}
fn_save_logo_alt($areas, $company_id);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:27,代码来源:fn.companies.php
示例20: fn_export_image
/**
* Export image (moves to selected directory on filesystem)
*
* @param int $image_id ID of the image
* @param string $object object to export image for (product, category, etc...)
* @param string $backup_path path to export image
* @return string path to the exported image
*/
function fn_export_image($image_id, $object, $backup_path = '')
{
$images_path = (!empty($backup_path) ? fn_strip_slashes($backup_path) : DIR_IMAGES . 'images_backup') . '/' . $object . '/';
// if backup dir does not exist then try to create it
if (!is_dir($images_path)) {
fn_mkdir($images_path);
}
$image_data = db_get_row("SELECT image_id, image_path FROM ?:images WHERE image_id = ?i", $image_id);
$alt_data = db_get_hash_single_array("SELECT lang_code, description FROM ?:common_descriptions WHERE ?:common_descriptions.object_id = ?i AND ?:common_descriptions.object_holder = 'images'", array('lang_code', 'description'), $image_id);
if (empty($image_data)) {
return '';
}
$path = $images_path . basename($image_data['image_path']);
$orig_path = DIR_IMAGES . $object . '/' . floor($image_id / MAX_FILES_IN_DIR) . '/' . $image_data['image_path'];
if (is_file($orig_path)) {
fn_copy($orig_path, $path);
}
return $path . (!empty($alt_data) ? '#' . serialize($alt_data) : '');
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:27,代码来源:exim.php
注:本文中的fn_copy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论