本文整理汇总了PHP中fn_rm函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_rm函数的具体用法?PHP fn_rm怎么用?PHP fn_rm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_rm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
public function generate($force = false)
{
$filename = $this->getFileName();
if (!is_dir(dirname($filename))) {
fn_mkdir(dirname($filename));
}
if ($force) {
fn_rm($filename);
}
if (!file_exists($filename)) {
fn_set_progress('echo', __('generating_xls'), false);
$header = $data = array();
$currencies = Registry::get('currencies');
$currency = $currencies[CART_SECONDARY_CURRENCY];
$currency_format = '#' . $currency['thousands_separator'] . '##0.' . str_repeat('0', $currency['decimals']);
$currency_format = $currency['after'] == 'Y' ? $currency_format . $currency['symbol'] : $currency['symbol'] . $currency_format;
foreach ($this->selected_fields as $field_id => $field_value) {
$header[$this->price_schema['fields'][$field_id]['title']] = $field_id == 'price' ? $currency_format : 'string';
}
$this->writer->writeSheetHeader($this->sheet, $header);
$this->render();
$this->writer->writeToFile($filename);
}
return $filename;
}
示例2: actionComplete
/**
* Setup complete action
*
* @param array $params Request variables
*
* @return bool Always true
*/
public function actionComplete($params = array())
{
$validator = new Validator();
$app = App::instance();
fn_define('CART_LANGUAGE', $app->getCurrentLangCode());
fn_define('DESCR_SL', $app->getCurrentLangCode());
$database = $app->getFromStorage('database_settings');
if (!empty($database)) {
$result = $validator->isMysqlSettingsValid($database['host'], $database['name'], $database['user'], $database['password'], $database['table_prefix'], $database['database_backend'], false);
if ($result) {
// Delete installer after store was installed.
fn_rm(Registry::get('config.dir.root') . '/install');
session_destroy();
$this->_prepareHttpData();
Session::init($params);
$user_data = array('user_id' => 1, 'user_type' => 'A', 'area' => 'A', 'login' => 'admin', 'is_root' => 'Y', 'company_id' => 0);
$_SESSION['auth'] = fn_fill_auth($user_data, array(), false, 'A');
if (is_file(Registry::get('config.dir.root') . '/install/index.php')) {
$_SESSION['notifications']['installer'] = array('type' => 'W', 'title' => 'warning', 'message' => 'delete_install_folder', 'message_state' => 'S', 'new' => true, 'extra' => '', 'init_message' => true);
}
$redirect_url = Registry::get('config.http_location') . '/' . Registry::get('config.admin_index') . '?welcome';
fn_redirect($redirect_url);
}
}
fn_redirect('install/index.php');
return true;
}
示例3: updateViaFtp
public function updateViaFtp($content, $settings)
{
$this->saveBackup();
$tmp_file = fn_create_temp_file();
fn_put_contents($tmp_file, $content);
$ftp_copy_result = fn_copy_by_ftp($tmp_file, $this->path, $settings);
fn_rm($tmp_file);
$status = $ftp_copy_result === true;
return array($status, $ftp_copy_result);
}
示例4: fn_rus_dellin_uninstall
function fn_rus_dellin_uninstall()
{
$service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'dellin');
if (!empty($service_ids)) {
db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids);
db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids);
}
db_query('DROP TABLE IF EXISTS ?:rus_dellin_cities');
$file_dir = fn_get_files_dir_path() . "dellin/";
fn_rm($file_dir);
}
示例5: fn_settings_actions_addons_seo
/**
* Check if mod_rewrite is active and clean up templates cache
*/
function fn_settings_actions_addons_seo(&$new_value, $old_value)
{
if ($new_value == 'A') {
$result = fn_http_request('GET', Registry::get('config.http_location') . '/catalog.html?version');
if (strpos($result[0]['RESPONSE'], '200 OK') === false) {
$new_value = 'D';
fn_set_notification('W', fn_get_lang_var('warning'), fn_get_lang_var('warning_seo_urls_disabled'));
}
}
fn_rm(DIR_COMPILED . 'customer');
return true;
}
示例6: clear
static function clear($changed_tables)
{
$tags = array();
foreach ($changed_tables as $table => $flag) {
if (!empty(self::$_cache_handlers[$table])) {
$tags = fn_array_merge($tags, array_keys(self::$_cache_handlers[$table]), false);
}
}
foreach ($tags as $tag) {
fn_rm(DIR_CACHE . $tag, true);
}
fn_put_contents(DIR_CACHE . self::$_handlers_name, serialize(self::$_cache_handlers));
return true;
}
示例7: update
public function update($id, $params)
{
$status = Response::STATUS_BAD_REQUEST;
$data = array();
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
if (isset($params['processor_params']['certificate_filename']) && !$params['processor_params']['certificate_filename']) {
fn_rm(Registry::get('config.dir.certificates') . $id);
}
$payment_id = fn_update_payment($params, $id, $lang_code);
if ($payment_id) {
$status = Response::STATUS_OK;
$data = array('payment_id' => $payment_id);
}
return array('status' => $status, 'data' => $data);
}
示例8: downloadPackage
/**
* Downloads upgrade package from the Upgade server
*
* @param array $schema Package schema
* @param string $package_path Path where the upgrade pack must be saved
* @return bool True if upgrade package was successfully downloaded, false otherwise
*/
public function downloadPackage($schema, $package_path)
{
$data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?dispatch=product_updates.get_package&package_id=' . $schema['package_id'] . '&edition=' . PRODUCT_EDITION . '&license_number=' . $this->uc_settings['license_number']);
if (!empty($data)) {
fn_put_contents($package_path, $data);
if (md5_file($package_path) == $schema['md5']) {
$result = array(true, '');
} else {
fn_rm($package_path);
$result = array(false, __('text_uc_broken_package'));
}
} else {
$result = array(false, __('text_uc_cant_download_package'));
}
return $result;
}
示例9: rotate
public function rotate()
{
if (file_exists($this->path . $this->filename)) {
if (empty($this->save_name)) {
$this->save_name = date('log_commerceml.txt', TIME);
}
fn_rename($this->path . $this->filename, $this->path . $this->save_name);
$logs_list = fn_get_dir_contents($this->path, false, true);
if (!empty($logs_list) && count($logs_list) > self::MAX_LOGS_FILE) {
rsort($logs_list);
list(, $old_logs) = array_chunk($logs_list, self::MAX_LOGS_FILE);
foreach ($old_logs as $filename) {
fn_rm($this->path . $filename);
}
}
}
}
示例10: 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']));
}
}
示例11: generate
public function generate($force = false)
{
$filename = $this->getFileName();
if (!is_dir(dirname($filename))) {
fn_mkdir(dirname($filename));
}
if ($force) {
fn_rm($filename);
}
// Min column width in percent
$min_width = array('product' => 50, 'product_code' => 13, 'image' => 10);
if (!file_exists($filename)) {
$max_perc = 100;
$field_count = count($this->selected_fields);
// First step. Check for the min width.
$perc = intval($max_perc / $field_count);
foreach ($this->selected_fields as $field_name => $active) {
if (isset($min_width[$field_name])) {
if ($min_width[$field_name] > $perc) {
$max_perc -= $min_width[$field_name];
$field_count--;
}
}
}
// Second step. Set up the new width values.
$perc = intval($max_perc / $field_count);
foreach ($this->selected_fields as $field_name => $active) {
if (!isset($min_width[$field_name]) || $min_width[$field_name] < $perc) {
$this->price_schema['fields'][$field_name]['min_width'] = $perc;
} else {
$this->price_schema['fields'][$field_name]['min_width'] = $min_width[$field_name];
}
}
fn_set_progress('echo', __('generating_pdf'), false);
$this->render();
}
return $filename;
}
示例12: fn_sdek_get_ticket_order
function fn_sdek_get_ticket_order($data_auth, $order_id, $chek_id)
{
unset($data_auth['Number']);
$xml = ' ' . RusSdek::arraySimpleXml('OrdersPrint', $data_auth, 'open');
$order_sdek = array('Number' => $order_id . '_' . $chek_id, 'Date' => $data_auth['Date']);
$xml .= ' ' . RusSdek::arraySimpleXml('Order', $order_sdek);
$xml .= ' ' . '</OrdersPrint>';
$response = RusSdek::xmlRequest('http://gw.edostavka.ru:11443/orders_print.php', $xml, $data_auth);
$download_file_dir = fn_get_files_dir_path() . '/sdek' . '/' . $chek_id . '/';
fn_rm($download_file_dir);
fn_mkdir($download_file_dir);
$name = $order_id . '.pdf';
$download_file_path = $download_file_dir . $name;
if (!fn_is_empty($response)) {
fn_put_contents($download_file_path, $response);
}
}
示例13: die
//
// $Id: site_layout.php 9938 2010-07-01 14:18:59Z 2tl $
//
if (!defined('AREA')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
fn_trusted_vars("lang_data");
$suffix = '';
if ($mode == 'update_design_mode') {
db_query("UPDATE ?:settings SET value = ?s WHERE option_name = ?s AND section_id = ?s", $action == $_REQUEST['design_mode'] ? 'Y' : 'N', $_REQUEST['design_mode'], '');
if (!empty($_REQUEST['disable_mode'])) {
db_query("UPDATE ?:settings SET value = 'N' WHERE option_name = ?s AND section_id = ?s", $_REQUEST['disable_mode'], '');
}
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'];
示例14: fn_delete_theme
/**
* Deletes theme
* @param string $theme_name theme name to delete. If empty - deletes all themes
* @return boolean true if deleted, false if not
*/
function fn_delete_theme($theme_name)
{
$themes_dest = fn_get_theme_path('[themes]/' . $theme_name, 'C');
$can_delete = true;
if (fn_allowed_for('ULTIMATE')) {
$company_themes = Settings::instance()->getAllVendorsValues('theme_name');
if (in_array($theme_name, $company_themes)) {
fn_set_notification('E', __('error'), __('error_delete_theme_company'));
$can_delete = false;
}
} else {
if ($theme_name == Registry::get('runtime.layout.theme_name')) {
$can_delete = false;
fn_set_notification('E', __('error'), __('cannot_remove_active_theme'));
}
}
$layouts = db_get_array('SELECT layout_id, is_default FROM ?:bm_layouts WHERE theme_name = ?s', $theme_name);
if ($can_delete && fn_rm($themes_dest)) {
// Delete layout
foreach ($layouts as $layout) {
Layout::instance()->delete($layout['layout_id']);
}
return true;
}
return false;
}
示例15: db_get_hash_array
$fields = db_get_hash_array("SHOW COLUMNS FROM {$table}", 'Field');
if (!empty($fields['is_global'])) {
// Sort table by is_global field
fn_echo('.');
db_query("ALTER TABLE {$table} ORDER BY is_global DESC");
} elseif (!empty($fields['position'])) {
// Sort table by position field
fn_echo('.');
db_query("ALTER TABLE {$table} ORDER BY position");
}
}
fn_set_notification('N', __('notice'), __('done'));
}
if ($mode == 'delete') {
if (!empty($_REQUEST['backup_file'])) {
fn_rm(Registry::get('config.dir.backups') . fn_basename($_REQUEST['backup_file']));
}
}
return array(CONTROLLER_STATUS_OK, 'datakeeper.manage');
}
if ($mode == 'getfile' && !empty($_REQUEST['file'])) {
fn_get_file(Registry::get('config.dir.backups') . fn_basename($_REQUEST['file']));
} elseif ($mode == 'manage') {
$view = Tygh::$app['view'];
// Calculate database size and fill tables array
$status_data = db_get_array("SHOW TABLE STATUS");
$database_size = 0;
$all_tables = array();
foreach ($status_data as $k => $v) {
$database_size += $v['Data_length'] + $v['Index_length'];
$all_tables[] = $v['Name'];