本文整理汇总了PHP中fn_log_event函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_log_event函数的具体用法?PHP fn_log_event怎么用?PHP fn_log_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_log_event函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fn_restore_dump
function fn_restore_dump($files)
{
if (empty($files)) {
return false;
}
fn_set_progress('parts', sizeof($files));
foreach ($files as $file) {
$is_archive = false;
$list = array($file);
if (in_array(fn_get_file_ext($file), array('zip', 'tgz'))) {
$is_archive = true;
fn_decompress_files(Registry::get('config.dir.database') . $file, Registry::get('config.dir.database') . '_tmp');
$list = fn_get_dir_contents(Registry::get('config.dir.database') . '_tmp', false, true, 'sql', '_tmp/');
}
foreach ($list as $_file) {
db_import_sql_file(Registry::get('config.dir.database') . $_file);
}
if ($is_archive) {
fn_rm(Registry::get('config.dir.database') . '_tmp');
}
}
// Log database restore
fn_log_event('database', 'restore');
fn_set_hook('database_restore', $files);
fn_clear_cache();
return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:27,代码来源:database.php
示例2: array
if (defined('AJAX_REQUEST') && empty($auth)) {
exit;
}
if (empty($auth['user_id'])) {
return array(CONTROLLER_STATUS_REDIRECT, $index_script);
}
fn_add_breadcrumb(fn_get_lang_var('my_account'));
$profile_id = 0;
$user_data = fn_get_user_info($auth['user_id'], true, $profile_id);
$view->assign('user_data', $user_data);
$view->assign('view_mode', 'simple');
} elseif ($mode == 'change_login') {
$auth = $_SESSION['auth'];
if (!empty($auth['user_id'])) {
// Log user logout
fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
}
unset($_SESSION['auth'], $_SESSION['cart']['user_data']);
fn_delete_cookies(AREA_NAME . '_user_id', AREA_NAME . '_password');
return array(CONTROLLER_STATUS_OK, fn_url('checkout.checkout'));
}
function fn_auth_routines($request)
{
$status = true;
$user_login = $_REQUEST['user_login'];
$password = $_POST['password'];
$field = Registry::get('settings.General.use_email_as_login') == 'Y' ? 'email' : 'user_login';
$user_data = db_get_row("SELECT * FROM ?:users WHERE {$field} = ?s", $user_login);
if (!empty($user_data)) {
$user_data['usergroups'] = fn_get_user_usergroups($user_data['user_id']);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:auth.php
示例3: db_export_to_file
/**
* Exports database to file
*
* @param string $file_name path to file will be created
* @param array $dbdump_tables List of tables to be exported
* @param bool $dbdump_schema Export database schema
* @param bool $dbdump_data Export tatabase data
* @param bool $log Log database export action
* @param bool $show_progress Show or do not show process by printing ' .'
* @param bool $move_progress_bar Move COMET progress bar or not on show progress
* @param array $change_table_prefix Array with 2 keys (from, to) to change table prefix
* @return bool false, if file is not accessible
*/
function db_export_to_file($file_name, $dbdump_tables, $dbdump_schema, $dbdump_data, $log = true, $show_progress = true, $move_progress_bar = true, $change_table_prefix = array())
{
$fd = @fopen($file_name, 'w');
if (!$fd) {
fn_set_notification('E', __('error'), __('dump_cant_create_file'));
return false;
}
if ($log) {
// Log database backup
fn_log_event('database', 'backup');
}
// set export format
Database::query("SET @SQL_MODE = 'MYSQL323'");
$create_statements = array();
$insert_statements = array();
if ($show_progress && $move_progress_bar) {
fn_set_progress('step_scale', sizeof($dbdump_tables) * ((int) $dbdump_schema + (int) $dbdump_data));
}
// get status data
$t_status = Database::getHash("SHOW TABLE STATUS", 'Name');
foreach ($dbdump_tables as $k => $table) {
$_table = !empty($change_table_prefix) ? str_replace($change_table_prefix['from'], $change_table_prefix['to'], $table) : $table;
if ($dbdump_schema) {
if ($show_progress) {
fn_set_progress('echo', '<br />' . __('backupping_schema') . ': <b>' . $table . '</b>', $move_progress_bar);
}
fwrite($fd, "\nDROP TABLE IF EXISTS " . $_table . ";\n");
$scheme = Database::getRow("SHOW CREATE TABLE {$table}");
$_scheme = array_pop($scheme);
if ($change_table_prefix) {
$_scheme = str_replace($change_table_prefix['from'], $change_table_prefix['to'], $_scheme);
}
fwrite($fd, $_scheme . ";\n\n");
}
if ($dbdump_data) {
if ($show_progress) {
fn_set_progress('echo', '<br />' . __('backupping_data') . ': <b>' . $table . '</b> ', $move_progress_bar);
}
$total_rows = Database::getField("SELECT COUNT(*) FROM {$table}");
// Define iterator
if (!empty($t_status[$table]) && $t_status[$table]['Avg_row_length'] < DB_MAX_ROW_SIZE) {
$it = DB_ROWS_PER_PASS;
} else {
$it = 1;
}
for ($i = 0; $i < $total_rows; $i = $i + $it) {
$table_data = Database::getArray("SELECT * FROM {$table} LIMIT {$i}, {$it}");
foreach ($table_data as $_tdata) {
$_tdata = fn_add_slashes($_tdata, true);
$values = array();
foreach ($_tdata as $v) {
$values[] = $v !== null ? "'{$v}'" : 'NULL';
}
fwrite($fd, "INSERT INTO {$_table} (`" . implode('`, `', array_keys($_tdata)) . "`) VALUES (" . implode(', ', $values) . ");\n");
}
if ($show_progress) {
fn_echo(' .');
}
}
}
}
fclose($fd);
@chmod($file_name, DEFAULT_FILE_PERMISSIONS);
return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:78,代码来源:fn.database.php
示例4: fn_twg_api_customer_logout
function fn_twg_api_customer_logout()
{
// copied from common/auth.php - logout mode
$auth = $_SESSION['auth'];
fn_save_cart_content($_SESSION['cart'], $auth['user_id']);
if (!empty($auth['user_id'])) {
// Log user logout
fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
}
unset($_SESSION['auth']);
fn_clear_cart($_SESSION['cart'], false, true);
fn_delete_session_data(fn_get_area_name() . '_user_id', fn_get_area_name() . '_password');
return true;
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:14,代码来源:func.php
示例5: restore
/**
* Restores backup file
*
* @param string $filename File to be restored
* @param string $base_path Base folder path (default: dir.backups)
* @return bool true if restored, error code if errors
*/
public static function restore($filename, $base_path = '')
{
$file_ext = fn_get_file_ext($filename);
if (!in_array($file_ext, array('sql', 'tgz', 'zip'))) {
return __(self::ERROR_UNSUPPORTED_FILE_TYPE);
}
if (empty($base_path)) {
$base_path = Registry::get('config.dir.backups');
}
$backup_path = $base_path . basename($filename);
if (in_array($file_ext, array('zip', 'tgz'))) {
$type = self::getArchiveType($backup_path);
$extract_path = fn_get_cache_path(false) . 'tmp/backup/';
fn_rm($extract_path);
fn_mkdir($extract_path);
if ($type == 'database') {
fn_decompress_files($backup_path, $extract_path);
$list = fn_get_dir_contents($extract_path, false, true, 'sql');
foreach ($list as $sql_file) {
db_import_sql_file($extract_path . $sql_file);
}
} else {
$root_dir = Registry::get('config.dir.root') . '/';
$files_list = self::getCompressedFilesList($backup_path);
// Check permissions on all files
foreach ($files_list as $file) {
if (!self::checkWritable($root_dir . $file)) {
return __(self::ERROR_UNWRITABLE_FILE, array('[file]' => $root_dir . $file, '[url]' => fn_url('settings.manage?section_id=Upgrade_center')));
}
fn_set_progress('echo', __('check_permissions') . ': ' . $file . '<br>', true);
}
// All files can be overrided. Restore backupped files
fn_decompress_files($backup_path, $extract_path);
$root_dir = Registry::get('config.dir.root') . '/';
foreach ($files_list as $file) {
$ext = fn_get_file_ext($file);
if ($ext == 'sql' && strpos($file, 'var/restore/') !== false) {
// This is a DB dump. Restore it
db_import_sql_file($extract_path . $file);
continue;
}
fn_set_progress('echo', __('restore') . ': ' . $file . '<br>', true);
self::restoreFile($extract_path . $file, $root_dir . $file);
}
fn_rm($extract_path);
return true;
}
} else {
db_import_sql_file($backup_path);
}
fn_log_event('database', 'restore');
fn_clear_cache();
return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:61,代码来源:DataKeeper.php
示例6: fn_error
function fn_error($debug_data, $error = '', $is_db = true)
{
$auth =& $_SESSION['auth'];
$debug_data = array_reverse($debug_data, true);
if (file_exists(DIR_ROOT . '/bug_report.php')) {
$bug_report = true;
}
if (!empty($bug_report)) {
ob_start();
}
if (!empty($error) && $is_db == true) {
// Log database errors
fn_log_event('database', 'error', array('error' => $error, 'backtrace' => $debug_data));
echo <<<EOT
<p><b><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Database error:</span></b> {$error['message']}<br>
<b><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Invalid query:</span></b> {$error['query']}</p>
EOT;
} elseif (!empty($error)) {
echo <<<EOT
<p><b><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Error:</span></b> {$error}<br>
EOT;
}
echo <<<EOU
<hr noshade width='100%'>
<p><span style='font-weight: bold; color: #000000; font-size: 13px; font-family: Courier;'>Backtrace:</span>
<table cellspacing='1'>
EOU;
$i = 0;
if (!empty($debug_data)) {
$func = '';
foreach (array_reverse($debug_data) as $v) {
if (empty($v['file'])) {
$func = $v['function'];
continue;
} elseif (!empty($func)) {
$v['function'] = $func;
$func = '';
}
$i = $i == 0 ? 1 : 0;
$color = $i == 0 ? "#DDDDDD" : "#EEEEEE";
echo "<tr bgcolor='{$color}'><td style='text-decoration: underline;'>File:</td><td>{$v['file']}</td></tr>";
echo "<tr bgcolor='{$color}'><td style='text-decoration: underline;'>Line:</td><td>{$v['line']}</td></tr>";
echo "<tr bgcolor='{$color}'><td style='text-decoration: underline;'>Function:</td><td>{$v['function']}</td></tr>";
}
}
echo '</table>';
if (!empty($bug_report)) {
$debug = ob_get_clean();
include DIR_ROOT . '/bug_report.php';
}
exit;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:52,代码来源:fn.common.php
示例7: fn_log_user_logout
/**
* Add a record to the log if the user session is expired
*
* @param array $entry - session record
* @return bool Always true
*/
function fn_log_user_logout($entry, $data)
{
if (!empty($data['auth']) && $data['auth']['user_id']) {
$this_login = empty($data['auth']['this_login']) ? 0 : $data['auth']['this_login'];
// Log user logout
fn_log_event('users', 'session', array('user_id' => $data['auth']['user_id'], 'ip' => empty($data['auth']['ip']) ? '' : $data['auth']['ip'], 'time' => $entry['expiry'] - $this_login, 'timeout' => true, 'expiry' => $entry['expiry']));
}
return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:15,代码来源:fn.log.php
示例8: fn_user_logout
/**
* @param array $auth
*/
function fn_user_logout($auth)
{
// Regenerate session_id for security reasons
fn_save_cart_content($_SESSION['cart'], $auth['user_id']);
Session::regenerateId();
fn_init_user();
$auth = $_SESSION['auth'];
if (!empty($auth['user_id'])) {
// Log user logout
fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false));
}
unset($_SESSION['auth']);
fn_clear_cart($_SESSION['cart'], false, true);
fn_delete_session_data(AREA . '_user_id', AREA . '_password');
unset($_SESSION['product_notifications']);
fn_login_user();
// need to fill $_SESSION['auth'] array for anonymous user
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:21,代码来源:fn.users.php
示例9: fn_log_user_logout
/**
* Add a record to the log if the user session is expired
*
* @param array $auth - user auth data
* @param integer $expiry - expiration time
* @return bool Always true
*/
function fn_log_user_logout($auth, $expiry = TIME)
{
if (!empty($auth) && $auth['user_id']) {
$this_login = empty($auth['this_login']) ? 0 : $auth['this_login'];
// Log user logout
fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'ip' => empty($auth['ip']) ? '' : $auth['ip'], 'time' => $expiry - $this_login, 'timeout' => true, 'expiry' => $expiry));
}
return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:16,代码来源:fn.users.php
示例10: fn_delete_order
/**
* Function delete order
*
* @param int $order_id
*/
function fn_delete_order($order_id)
{
// Log order deletion
fn_log_event('orders', 'delete', array('order_id' => $order_id));
fn_change_order_status($order_id, STATUS_INCOMPLETED_ORDER, '', fn_get_notification_rules(array(), false));
// incomplete to increase inventory
fn_set_hook('delete_order', $order_id);
db_query("DELETE FROM ?:new_orders WHERE order_id = ?i", $order_id);
db_query("DELETE FROM ?:order_data WHERE order_id = ?i", $order_id);
db_query("DELETE FROM ?:order_details WHERE order_id = ?i", $order_id);
db_query("DELETE FROM ?:orders WHERE order_id = ?i", $order_id);
db_query("DELETE FROM ?:product_file_ekeys WHERE order_id = ?i", $order_id);
db_query("DELETE FROM ?:profile_fields_data WHERE object_id = ?i AND object_type='O'", $order_id);
db_query("DELETE FROM ?:order_docs WHERE order_id = ?i", $order_id);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:20,代码来源:fn.cart.php
示例11: generate
public function generate($filepath = '')
{
@ignore_user_abort(1);
@set_time_limit(0);
register_shutdown_function(array($this, 'shutdownHandler'));
if (!empty($filepath)) {
$this->filepath_temp = $filepath;
}
fn_mkdir(dirname($this->filepath_temp));
$continue = false;
if (file_exists($this->filepath_temp) && $this->offset > 0) {
$continue = true;
}
if ($continue) {
$this->log->write(Logs::INFO, '', 'Continue ' . date('d.m.Y H:i:s', time()) . '. Offset ' . $this->offset);
} else {
$status_generate = fn_get_storage_data('yml2_status_generate_' . $this->price_id);
if ($status_generate == 'active' && file_exists($this->filepath_temp)) {
fn_echo(__("yml_export.generation_was_started"));
exit;
}
fn_rm($this->filepath_temp);
$this->offset = 0;
$this->log->write(Logs::INFO, '', 'Start ' . date('d.m.Y H:i:s', time()));
fn_set_storage_data('yml2_export_start_time_' . $this->price_id, time());
}
fn_set_storage_data('yml2_status_generate_' . $this->price_id, 'active');
$file = fopen($this->filepath_temp, 'ab');
if (!$continue) {
$this->head($file);
}
$this->body($file);
$this->bottom($file);
fclose($file);
$this->log->write(Logs::INFO, '', 'Finish ' . date('d.m.Y H:i:s', time()));
$this->log->write(Logs::INFO, '', 'Product export ' . $this->yml2_product_export . '. Product skip ' . $this->yml2_product_skip);
$data = array('[export]' => $this->yml2_product_export, '[skip]' => $this->yml2_product_skip, '[cron]' => defined('CONSOLE') ? 'Cron. ' : '');
fn_log_event('yml_export', 'export', array('message' => __('text_log_action_export', $data)));
if ($this->options['detailed_generation'] == 'Y') {
$path = $this->log->getTempLogFile();
if ($path) {
$log = fopen($path, 'r');
$line = fgets($log);
$info_line = true;
while (!feof($log)) {
$line = fgets($log);
if (empty($line)) {
continue;
}
$data = explode(';', $line);
if ($data[0] == '[INFO]' && !$info_line) {
fn_echo(NEW_LINE);
} elseif ($data[0] != '[INFO]' && $info_line) {
fn_echo(NEW_LINE);
}
$data[1] = isset($data[1]) ? $data[1] : '';
$data[2] = isset($data[2]) ? $data[2] : '';
fn_echo($data[0] . $data[1] . $data[2] . NEW_LINE);
$info_line = $data[0] == '[INFO]';
}
fclose($log);
}
}
$this->log->rotate();
if (empty($filepath)) {
$this->backupYml();
if (file_exists($this->filepath_temp)) {
fn_rm($this->filepath);
fn_rename($this->filepath_temp, $this->filepath);
}
}
fn_set_storage_data('yml2_product_export_' . $this->price_id);
fn_set_storage_data('yml2_product_skip_' . $this->price_id);
fn_set_storage_data('yml2_export_start_time_' . $this->price_id);
fn_set_storage_data('yml2_export_count_' . $this->price_id);
fn_set_storage_data('yml2_export_offset_' . $this->price_id);
fn_set_storage_data('yml2_export_time_' . $this->price_id, time());
fn_set_storage_data('yml2_status_generate_' . $this->price_id, 'finish');
}
开发者ID:ambient-lounge,项目名称:site,代码行数:79,代码来源:Yml2.php
示例12: logEvent
/**
* Set event to log
* @param string $type
* @param string $action
* @param array $data
*/
protected static function logEvent($type, $action, array $data = array())
{
fn_log_event($type, $action, $data);
}
开发者ID:ambient-lounge,项目名称:site,代码行数:10,代码来源:DataKeeper.php
示例13: fn_update_news
function fn_update_news($news_id, $news_data, $lang_code = CART_LANGUAGE)
{
// news title required
if (empty($news_data['news'])) {
return false;
}
$_data = $news_data;
$_data['date'] = fn_parse_date($news_data['date']);
if (isset($_data['localization'])) {
$_data['localization'] = empty($_data['localization']) ? '' : fn_implode_localizations($_data['localization']);
}
if (empty($news_id)) {
$create = true;
$news_id = $_data['news_id'] = db_query("REPLACE INTO ?:news ?e", $_data);
if (empty($news_id)) {
return false;
}
// Adding descriptions
foreach ((array) Registry::get('languages') as $_data['lang_code'] => $v) {
db_query("INSERT INTO ?:news_descriptions ?e", $_data);
}
} else {
if (!empty($news_data['block_id'])) {
fn_add_items_to_block($news_data['block_id'], $news_data['add_items'], $news_id, 'news');
}
db_query("UPDATE ?:news SET ?u WHERE news_id = ?i", $_data, $news_id);
// update news descriptions
$_data = $news_data;
db_query("UPDATE ?:news_descriptions SET ?u WHERE news_id = ?i AND lang_code = ?s", $_data, $news_id, $lang_code);
}
// Log news update/add
fn_log_event('news', !empty($create) ? 'create' : 'update', array('news_id' => $news_id));
fn_set_hook('update_news', $news_data, $news_id, $lang_code);
return $news_id;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:35,代码来源:func.php
示例14: empty
if (!empty($cart['failed_order_id'])) {
$_msg = !empty($_payment_info['reason_text']) ? $_payment_info['reason_text'] : '';
$_msg .= empty($_msg) ? __('text_order_placed_error') : '';
fn_set_notification('O', '', $_msg);
$cart['processed_order_id'] = $cart['failed_order_id'];
unset($cart['failed_order_id']);
}
unset($_payment_info['card_number'], $_payment_info['cvv2']);
$cart['payment_info'] = $_payment_info;
if (!empty($cart['extra_payment_info'])) {
$cart['payment_info'] = array_merge($cart['payment_info'], $cart['extra_payment_info']);
}
}
}
if ($mode == 'change_login') {
$auth = $_SESSION['auth'];
if (!empty($auth['user_id'])) {
fn_log_event('users', 'session', array('user_id' => $auth['user_id'], 'time' => TIME - $auth['this_login'], 'timeout' => false, 'company_id' => fn_get_company_id('users', 'user_id', $auth['user_id'])));
}
unset($_SESSION['auth'], $_SESSION['cart']['user_data']);
fn_delete_session_data(AREA . '_user_id', AREA . '_password');
return array(CONTROLLER_STATUS_OK, 'onestepcheckout.checkout');
}
if (!empty($profile_fields)) {
Registry::get('view')->assign('profile_fields', $profile_fields);
}
Registry::get('view')->assign('cart', $cart);
Registry::get('view')->assign('continue_url', empty($_SESSION['continue_url']) ? '' : $_SESSION['continue_url']);
Registry::get('view')->assign('mode', $mode);
Registry::get('view')->assign('payment_methods', $payment_methods);
$_SESSION['checkout_mode'] = $mode;
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:onestepcheckout.php
示例15: _generateError
/**
* Generates error notification
*
* @param string $action Action thae was happen
* @param string $reason Reason, why the error notification must be showed
* @param string $table Table name (optional)
* @return bool Always true
*/
private function _generateError($action, $reason, $table = '')
{
$message = str_replace("[reason]", $reason, $action);
if (!empty($table)) {
$message = str_replace("[table]", $table, $message);
}
fn_log_event('settings', 'error', $message);
if (Debugger::isActive() || fn_is_development()) {
fn_set_notification('E', __('error'), $message);
}
return true;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:20,代码来源:Settings.php
示例16: foreach
$suffix = '';
if ($mode == 'm_delete' && !empty($_REQUEST['order_ids'])) {
foreach ($_REQUEST['order_ids'] as $v) {
fn_delete_order($v);
}
}
if ($mode == 'update_details') {
fn_trusted_vars('update_order');
// Update customer's email if its changed in customer's account
if (!empty($_REQUEST['update_customer_details']) && $_REQUEST['update_customer_details'] == 'Y') {
$u_id = db_get_field("SELECT user_id FROM ?:orders WHERE order_id = ?i", $_REQUEST['order_id']);
$current_email = db_get_field("SELECT email FROM ?:users WHERE user_id = ?i", $u_id);
db_query("UPDATE ?:orders SET email = ?s WHERE order_id = ?i", $current_email, $_REQUEST['order_id']);
}
// Log order update
fn_log_event('orders', 'update', array('order_id' => $_REQUEST['order_id']));
db_query('UPDATE ?:orders SET ?u WHERE order_id = ?i', $_REQUEST['update_order'], $_REQUEST['order_id']);
//Update shipping info
if (!empty($_REQUEST['update_shipping'])) {
foreach ($_REQUEST['update_shipping'] as $group_key => $shipment) {
$shipment['shipment_data']['order_id'] = $_REQUEST['order_id'];
$shipment_id = isset($shipment['shipment_id']) ? $shipment['shipment_id'] : 0;
fn_update_shipment($shipment['shipment_data'], $shipment_id, $group_key, true);
}
}
// Add new shipping info
/*if (!empty($_REQUEST['add_shipping'])) {
$shipping = db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i', $_REQUEST['add_shipping']['shipping_id']);
$shippings[$_REQUEST['add_shipping']['shipping_id']] = array(
'shipping' => $shipping,
'tracking_number' => $_REQUEST['add_shipping']['tracking_number'],
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:orders.php
示例17: fn_update_product
function fn_update_product($product_data, $product_id = 0, $lang_code = CART_LANGUAGE)
{
$_data = $product_data;
if (!empty($product_data['timestamp'])) {
$_data['timestamp'] = fn_parse_date($product_data['timestamp']);
// Minimal data for product record
}
if (!empty($product_data['avail_since'])) {
$_data['avail_since'] = fn_parse_date($product_data['avail_since']);
}
if (isset($product_data['tax_ids'])) {
$_data['tax_ids'] = empty($product_data['tax_ids']) ? '' : fn_create_set($product_data['tax_ids']);
}
if (isset($product_data['localization'])) {
$_data['localization'] = empty($product_data['localization']) ? '' : fn_implode_localizations($_data['localization']);
}
if (isset($product_data['usergroup_ids'])) {
$_data['usergroup_ids'] = empty($product_data['usergroup_ids']) ? '' : implode(',', $_data['usergroup_ids']);
}
if (Registry::get('settings.General.allow_negative_amount') == 'N' && isset($_data['amount'])) {
$_data['amount'] = abs($_data['amount']);
}
// add new product
if (empty($product_id)) {
$create = true;
// product title can't be empty
if (empty($product_data['product'])) {
return false;
}
$product_id = db_query("INSERT INTO ?:products ?e", $_data);
if (empty($product_id)) {
return false;
}
//
// Adding same product descriptions for all cart languages
//
$_data = $product_data;
$_data['product_id'] = $product_id;
$_data['product'] = trim($_data['product'], " -");
foreach ((array) Registry::get('languages') as $_data['lang_code'] => $_v) {
db_query("INSERT INTO ?:product_descriptions ?e", $_data);
}
// update product
} else {
if (isset($product_data['product']) && empty($product_data['product'])) {
unset($product_data['product']);
}
db_query("UPDATE ?:products SET ?u WHERE product_id = ?i", $_data, $product_id);
$_data = $product_data;
if (!empty($_data['product'])) {
$_data['product'] = trim($_data['product'], " -");
}
db_query("UPDATE ?:product_descriptions SET ?u WHERE product_id = ?i AND lang_code = ?s", $_data, $product_id, $lang_code);
}
// Log product add/update
fn_log_event('products', !empty($create) ? 'create' : 'update', array('product_id' => $product_id));
if (!empty($product_data['product_features'])) {
$i_data = array('product_id' => $product_id, 'lang_code' => $lang_code);
foreach ($product_data['product_features'] as $feature_id => $value) {
// Check if feature is applicable for this product
$id_paths = db_get_fields("SELECT ?:categories.id_path FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id WHERE product_id = ?i", $product_id);
$_params = array('category_ids' => array_unique(explode('/', implode('/', $id_paths))), 'feature_id' => $feature_id);
list($_feature) = fn_get_product_features($_params);
if (empty($_feature)) {
$_feature = db_get_field("SELECT description FROM ?:product_features_descriptions WHERE feature_id = ?i AND lang_code = ?s", $feature_id, CART_LANGUAGE);
$_product = db_get_field("SELECT product FROM ?:product_descriptions WHERE product_id = ?i AND lang_code = ?s", $product_id, CART_LANGUAGE);
fn_set_notification('E', fn_get_lang_var('error'), str_replace(array('[feature_name]', '[product_name]'), array($_feature, $_product), fn_get_lang_var('product_feature_cannot_assigned')));
continue;
}
$i_data['feature_id'] = $feature_id;
unset($i_data['value']);
unset($i_data['variant_id']);
unset($i_data['value_int']);
$feature_type = db_get_field("SELECT feature_type FROM ?:product_features WHERE feature_id = ?i", $feature_id);
// Delete variants in current language
if ($feature_type == 'T') {
db_query("DELETE FROM ?:product_features_values WHERE feature_id = ?i AND product_id = ?i AND lang_code = ?s", $feature_id, $product_id, $lang_code);
} else {
db_query("DELETE FROM ?:product_features_values WHERE feature_id = ?i AND product_id = ?i", $feature_id, $product_id);
}
if ($feature_type == 'D') {
$i_data['value_int'] = fn_parse_date($value);
} elseif ($feature_type == 'M') {
if (!empty($product_data['add_new_variant'][$feature_id]['variant'])) {
$value = empty($value) ? array() : $value;
$value[] = fn_add_feature_variant($feature_id, $product_data['add_new_variant'][$feature_id]);
}
if (!empty($value)) {
foreach ($value as $variant_id) {
foreach (Registry::get('languages') as $i_data['lang_code'] => $_d) {
// insert for all languages
$i_data['variant_id'] = $variant_id;
db_query("REPLACE INTO ?:product_features_values ?e", $i_data);
}
}
}
continue;
} elseif (in_array($feature_type, array('S', 'N', 'E'))) {
if (!empty($product_data['add_new_variant'][$feature_id]['variant'])) {
$i_data['variant_id'] = fn_add_feature_variant($feature_id, $product_data['add_new_variant'][$feature_id]);
//.........这里部分代码省略.........
开发者ID:diedsmiling,项目名称:busenika,代码行数:101,代码来源:fn.products.php
示例18: _error
/**
* Display database error
*
* @param resource $result result, returned by database server
* @param string $query SQL query, passed to server
* @return mixed false if no error, dies with error message otherwise
*/
private static function _error($result, $query)
{
if (!empty($result) || self::$_db->errorCode() == 0) {
// it's ok
} else {
$error = array('message' => self::$_db->error() . ' <b>(' . self::$_db->errorCode() . ')</b>', 'query' => $query);
if (Registry::get('runtime.database.skip_errors') == true) {
Registry::push('runtime.database.errors', $error);
} else {
// Log database errors
fn_log_event('database', 'error', array('error' => $error, 'backtrace' => debug_backtrace()));
throw new DatabaseException($error['message'] . "<p>{$error['query']}</p>");
}
}
return false;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:23,代码来源:Database.php
示例19: fn_generate_deprecated_function_notice
/**
* Function print notice that function $old_function is deprecated and must be replaced by $new_function
* @param string $old_function Name of the old function
* @param string $new_function Name of the new function
*/
function fn_generate_deprecated_function_notice($old_function, $new_function)
{
$message = __('function_deprecated', array('[old_function]' => $old_function, '[new_function]' => $new_function));
if (Debugger::isActive()) {
fn_set_notification('E', __('error'), $message);
}
fn_log_event('general', 'deprecated', array('function' => $old_function, 'message' => $message, 'backtrace' => debug_backtrace()));
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:13,代码来源:fn.common.php
示例20: fn_delete_news
function fn_delete_news($news_id)
{
// Log news deletion
fn_log_event('news', 'delete', array('news_id' => $news_id));
fn_clean_block_items('news', $news_id);
fn_clean_block_links('news', $news_id);
db_query("DELETE FROM ?:news WHERE news_id = ?i", $news_id);
db_query("DELETE FROM ?:news_descriptions WHERE news_id = ?i", $news_id);
fn_set_hook('delete_news', $news_id);
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:10,代码来源:news.php
注:本文中的fn_log_event函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论